David Kimura PRO
Joined 7/18/2015
Drifting Ruby Owner
David Kimura PRO said about 5 years ago on Gem in a Box :
  It's just a preference when creating an array or hash. In this particular case there wouldn't be any benefit over
array = []
array << { username: 'username', password: 'password' }

However, in many other situations doing a [].tap or {}.tap is pretty handy in conditionally adding items. For example,

User.new(user_params)

def user_params
  allowed_params = [].tap do |array|
    array << :first_name
    array << :last_name
    array << :admin if current_user.admin?
  end
  params.require(:user).permit(allowed_params)
end



David Kimura PRO said about 5 years ago on Creating and Reading QR Codes :
  Look at your browser's console to see if there are any errors

David Kimura PRO said about 5 years ago on Hotwire & ViewComponents :
I think that would be a worthy episode :)

David Kimura PRO said about 5 years ago on Embedding Youtube Videos into Action Text with Stimulus :
  I'm using a variation of this method for the Drifting Ruby videos. However, it's pretty much on par with how I'm doing it. One thing that I do prior to uploading the video is first using Handbrake to transcode the video. https://www.driftingruby.com/episodes/adaptive-bitrate-streaming-with-active-storage 


David Kimura PRO said about 5 years ago on Embedding Youtube Videos into Action Text with Stimulus :
Ah gotcha. Yes, if a user is not logged into the site, they will get an embedded youtube video. It looks like this site may suggestions to control this at the Youtube config level. https://moz.com/community/q/allow-embedding-on-a-youtube-but-only-for-specific-sites