I coded strong parameters, but...

75 views
Skip to first unread message

Thomas Connolly

unread,
Aug 18, 2014, 9:55:10 PM8/18/14
to refine...@googlegroups.com
... I'm getting this error:

Please override sermon_params with your desired parameter security.

Here's my controller:

module Refinery
  module Sermons
    module Admin
      class SermonsController < ::Refinery::AdminController

        crudify :'refinery/sermons/sermon',
                :title_attribute => 'title',
                :order => "date DESC",
                :sortable => "false",
                :xhr_paging => true

      end
    end
  end

  protected
    def sermon_params
      params.require(:sermon).permit( :homilist, :delivered_on, :title, :content, :cites )
    end
end

What else should I be looking at to fix this?  Thanks

Philip Arndt

unread,
Aug 19, 2014, 3:43:29 AM8/19/14
to refine...@googlegroups.com
It seems like you're defining it in the top level Refinery module rather than inside the class definition.

This might work better:

    module Refinery
      module Sermons
        module Admin
          class SermonsController < ::Refinery::AdminController

            crudify :'refinery/sermons/sermon',
                    :title_attribute => 'title',
                    :order => "date DESC",
                    :sortable => "false",
                    :xhr_paging => true

            protected
            def sermon_params
              params.require(:sermon).permit(:homilist, :delivered_on, :title, :content, :cites)
            end

          end
        end
      end
    end

Chris Yate

unread,
Jan 21, 2015, 5:22:25 PM1/21/15
to refine...@googlegroups.com
Thanks!  This was the hint I needed to get the strong params thing working with Crudify. 

Would there be scope for getting this snippet on the RefineryCMS help pages?

Chris

Philip Arndt

unread,
Jan 21, 2015, 5:36:54 PM1/21/15
to refine...@googlegroups.com
We're actually looking to get this generated with the extensions.  See this issue for details: https://github.com/refinery/refinerycms/issues/2753
Reply all
Reply to author
Forward
0 new messages