ruby on rails - Devise uses app's layout but ignores ApplicationController methods and filters -


devise using host application's layout not controller methods , before_ filters specified in applicationcontroller. error alludes fact @sitemap nil in part of layout: <%= select_tag :site_navigation, options_for_select(@sitemap), prompt: "quick navigation" %>


manager/application_controller.rb

module manager     class applicationcontroller < actioncontroller::base          protect_from_forgery         before_filter :load_sitemap          ... more code here ...       protected          # run every time request made...but         # doesn't run devise's sessionscontroller         # though devise uses layout uses         # @sitemap , fails if nil         def load_sitemap             return [] unless manager.configuration.master?             @sitemap = {                 "albums" => albums_path,                 "add wine award" => new_award_path,                 "businesses" => businesses_path,                 "cash tracking" => cash_trackers_path,                 "events" => events_path,                 "locations" => locations_path,                 "medals" => medals_path,                 "new timesheet" => new_timesheet_path,                 "recipes" => recipes_path,                 "reviews" => reviews_path,                 "wines" => wines_path,                 "wine competitions" => competitions_path             }         end     end  end 

this name-spacing problem based on use of manager module.

devise's user_controller inherit applicationcontroller. not manager::applicationcontroller

if want devise run before filter, need put root-level applicatoncontroller instead.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -