i have bootstrap navbar, tabs generated @ runtime. it's way because link show/:id , user can delete record associated tab @ time. created links this:
<% @groups.each |group| %> <li id=<%= group.id %>><%= link_to t("navbar." + group.name.singularize.downcase), :controller => 'groups', :action => 'show', :id => group.id %></li> <% end %> this works fine until use devise , attempt /admins/sign_in. navbar code still same, urlgenerationerror:
no route matches {:action=>"show", :controller=>"devise/groups", :id=>4, :locale=>nil} my guess error stems controller being "devise/groups" that's difference spot. there way can tell not prepend "devise"? or have write new routes these bits? if have add new routes, how can use resources in routes?
i suspect devise break other links on other pages had code way.
routes:
rails.application.routes.draw devise_for :admins 'search/index' 'tags/:tag', to: "search#index", as: :tag scope "(:locale)", :locale => /#{i18n.available_locales.join("|")}/ 'home/index' root :to => "home#index" resources :brands resources :faqs resources :categories resources :subgroups resources :groups end update: tried changing link following
<% @groups.each |group| %> <li id=<%= group.id %>><%= link_to(t("navbar." + group.name.singularize.downcase), url_for(:controller => 'groups', :action => 'show', :id => group.id)) %></li> <% end %> but still comes "devise/groups" controller when access sign-in page. after sign in, there's no problem.
i have strange "fix" not feel correct in slightest. created new controllers derive devise::[name]controllers, , did following whatever methods needed
def new super end then edited routes.rb
devise_for :admins, :controllers => {:[name] => "[name]"} with new :[name] => "[name]" pair each controller had make. determined ones needed looking @ rake routes. everything's working, i'm sure there's cleaner fix out there.
p.s. may need run rails g devise:views
Comments
Post a Comment