Search code examples
ruby-on-railsrubyherokurefinerycms

private method `prepend' called for Refinery::Admin::PagesController:Class (NoMethodError)


I'm having an issue with heroku not running my app.

I'm using refinerycms and trying to put my nav menu in the footer per this tutorial.

I pushed everything to heroku successfully.

heroku run rake db:migrate worked fine.

When I try to open the app on heroku, I get this error in the logs:

/app/app/decorators/controllers/refinery/pages_controller.rb:1:in `<top (required)>': private method `prepend' called for Refinery::Admin::PagesController:Class (NoMethodError)

This is the file causing the error: pages_controller_decorator.rb

Refinery::Admin::PagesController.prepend(
  Module.new do
    def permitted_page_params
      super << :show_in_footer
    end
  end
)

Obviously heroku is having an issue with the prepend method, but I'm not sure how to make my footer action work without it.


Solution

  • There is an ability to call private methods in ruby using send. I am not sure, if this is intended to be used particularly here, but just change

    Refinery::Admin::PagesController.prepend(MODULE_CODE)
    

    to

    Refinery::Admin::PagesController.send :prepend, MODULE_CODE