Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Sebastian Wilgosz's Profile

GitHub User: wilgoszpl

Site: http://wilgosz.pl

Comments by Sebastian Wilgosz

Avatar

Thanks a lot, Rayan. You do great job with RailsCasts. This website is the most useful source about rails.

Anyway, function load_and_authorize_resource not works properly with Rails4. There is ForbiddenAttributesError generated sometimes. To solve it we should type this code into our applicationController

ruby
  before_filter do
          return if !(request.post? or request.patch? or request.put?)
                resource = controller_path.singularize.gsub('/', '_').to_sym
                method = "#{resource}_params"
                params[resource] &&= send(method) if respond_to?(method, true)
        end