Using Inherited Resources with strong parameters

21 Aug 2013

I just started a new project where I'm going to use Rails 4 and the inherited_resources gem to speed up development a little.

Since inherited_resources is not fully compatible with Rails 4's Strong Parameters, the way to whitelist attributes is:

class CustomersController < InheritedResources::Base
  protected

  def permitted_params
    params.permit(:customer => [:name, :email, :phone_number])
  end
end

Notes:

There's an open pull request to integrate with Strong Parameters and solve the weird notation issue, but since it isn't merged yet, I guess we'll have to stick with this notation for now.