March 22, 2016 by Daniel P. Clark

Rails: Has One Through Polymorphic Relation

As I’ve described in my blog post “Rails Polymorphic Associations” I’ve stated that polymorphic relations in Rails are best for scenarios where a model may “belong to” one of many other kinds of model.  So a Comment model with the polymorphic commentable relationship can belong to any other record in your Rails app.  This is…

Continue Reading »

January 5, 2015 by Daniel P. Clark

Dealing with Rails 4 forms and params

In the learning stage of Rails developments one will come across different scenarios of handling parameters from Rails forms that are submitted.  Also since Rails 4 introduced Strong Parameters there are some additional things to keep in mind. Form Params 101 Parameters: { “utf8″=>”✓”, “authenticity_token”=>”nqLr/ZukyXt5/sFNU9FGciBbSOSJ2MkE7Roo5WwfVEo=”, “profile”=>{ “first_name”=>”Daniel”, “last_name”=>”Clark”, “socials_attributes”=>{ “0”=>{ “kind”=>”twitter”, “username”=>”@6ftdan” } } },…

Continue Reading »