David Kimura PRO
Joined 7/18/2015
Drifting Ruby Owner
David Kimura PRO said about 6 years ago on Deploying to AWS Elastic Beanstalk :
  In this example, the SECRECT_KEY_BASE is an environment variable and is used in the config/secrets.yml.  Within AWS Beanstalk's Configuration Overview (Elastic Beanstalk > Environments > Your App > Configuration), you can create an Environment Property which is where you set the environment variables. Any environment variable set here will be available to the EC2 instances that are created.

David Kimura PRO said almost 6 years ago on Audio Streaming with Active Storage :
  Check out the video on streaming videos where it shows how to use the controller to send the Active Storage url instead of having it embed within the view. This may help protect the link as it is then able to be authenticated and authorized via the controller. https://www.driftingruby.com/episodes/streaming-videos-with-active-storage


David Kimura PRO said almost 6 years ago on Tracking Changes on Action Text :
Cool   ! Rails provides so much. I could spend days just reading the docs and learn so much.

David Kimura PRO said almost 6 years ago on Tracking Changes on Action Text :
  I would actually prefer a separate controller. When I first started out development, I would have several compromises with my controllers. First they were fat controllers, then they had various actions outside of the standards and so on. These all seemed fine until I had to go back and work on these older applications and these kinds of patterns were a pain to go back and work in. So, I would actually have a different controller and in this particular case, I would not have it dependent on articles. I would have probably do something like

resources :versions, only: [] do
  resource :restore
end

The reason why I would prefer leaving the article out of it is that the polymorphic association in the Version table already knows who the item belongs to. So, we can look up that item and do the necessary checks. I also like this way because then we can write it one time, and not have to worry about all of the different Action Text attributes used by other models; this solution would work for all of them.

David Kimura PRO said almost 6 years ago on Tracking Changes on Action Text :
  You should be able to have a controller action with the content

version = Version.includes(:item).find(params[:id])
itemable = version.item
itemable.content = version.content
itemable.save

It should take the content of the version and set it to the related content. This of course would then create a new version based on this version.