January 12, 2017 by Daniel P. Clark

Re: What is the splat operator doing here?

I’ve received an email from a fellow software developer inquiring about a bit of code where I use Ruby’s splat operator in two different ways.  In my Ruby gem cards_lib I wrote a “macro” to take a list of strings and generate card instances from them.  You don’t really hear of macros in the Ruby community…

Continue Reading »

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

Submitted forms return a JSON response with data in it.  You can access…

Continue Reading »