bump The reason why player path wasnt working was because it required an instance of player: player_path(@player). But I am still stuck as to why dashboard_sidebar_path isn't working when the route clearly shows up when running rake routes.
On Sep 4, 4:20 pm, John Merlino <stoici...@aol.com> wrote: > thanks for response > > I see some other strange stuff going on. > > for example, I have something like this: > > resources :players do > member do > get :reject > end > resources :saleries > end > > And I use a link_to helper to try to access the reject_player_path in > my dashboard show haml file and I get an error: > > No route matches {:action=>"reject", :controller=>"players"} > > And I try to even just try a player_path helper, which should exist > for show (when using link_to in other words get requests) and update > (when using form_for in other words post requests), yet I get this > error: > > No route matches {:action=>"show", :controller=>"players"} > > But obviously, these exceptions are wrong, as when I run rake routes, > these matches indeed do exist: > > root / > (.:format) > {:controller=>"dashboard", :action=>"show"} > team_players GET /teams/:team_id/ > players(.:format) > {:action=>"index", :controller=>"players"} > POST /teams/:team_id/ > players(.:format) > {:action=>"create", :controller=>"players"} > new_team_player GET /teams/:team_id/players/ > new(.:format) {:action=>"new", :controller=>"players"} > edit_team_player GET /teams/:team_id/players/:id/ > edit(.:format) {:action=>"edit", :controller=>"players"} > team_player GET /teams/:team_id/ > players/:id(.:format) > {:action=>"show", :controller=>"players"} > PUT /teams/:team_id/ > players/:id(.:format) > {:action=>"update", :controller=>"players"} > DELETE /teams/:team_id/ > players/:id(.:format) > {:action=>"destroy", :controller=>"players"} > teams GET / > teams(.:format) > {:action=>"index", :controller=>"teams"} > POST / > teams(.:format) > {:action=>"create", :controller=>"teams"} > new_team GET /teams/ > new(.:format) > {:action=>"new", :controller=>"teams"} > edit_team GET /teams/:id/ > edit(.:format) > {:action=>"edit", :controller=>"teams"} > team GET / > teams/:id(.:format) > {:action=>"show", :controller=>"teams"} > PUT / > teams/:id(.:format) > {:action=>"update", :controller=>"teams"} > DELETE / > teams/:id(.:format) > {:action=>"destroy", :controller=>"teams"} > reject_player GET /players/:id/ > reject(.:format) > {:action=>"reject", :controller=>"players"} > player_saleries GET /players/:player_id/ > saleries(.:format) > {:action=>"index", :controller=>"saleries"} > POST /players/:player_id/ > saleries(.:format) > {:action=>"create", :controller=>"saleries"} > new_player_salery GET /players/:player_id/saleries/ > new(.:format) {:action=>"new", :controller=>"saleries"} > edit_player_salery GET /players/:player_id/saleries/:id/ > edit(.:format) {:action=>"edit", :controller=>"saleries"} > player_salery GET /players/:player_id/ > saleries/:id(.:format) {:action=>"show", :controller=>"saleries"} > PUT /players/:player_id/ > saleries/:id(.:format) > {:action=>"update", :controller=>"saleries"} > DELETE /players/:player_id/ > saleries/:id(.:format) > {:action=>"destroy", :controller=>"saleries"} > players GET / > players(.:format) > {:action=>"index", :controller=>"players"} > POST / > players(.:format) > {:action=>"create", :controller=>"players"} > new_player GET /players/ > new(.:format) > {:action=>"new", :controller=>"players"} > edit_player GET /players/:id/ > edit(.:format) > {:action=>"edit", :controller=>"players"} > player GET / > players/:id(.:format) > {:action=>"show", :controller=>"players"} > PUT / > players/:id(.:format) > {:action=>"update", :controller=>"players"} > DELETE / > players/:id(.:format) > {:action=>"destroy", :controller=>"players"} > saleries GET / > saleries(.:format) > {:action=>"index", :controller=>"saleries"} > POST / > saleries(.:format) > {:action=>"create", :controller=>"saleries"} > new_salery GET /saleries/ > new(.:format) > {:action=>"new", :controller=>"saleries"} > edit_salery GET /saleries/:id/ > edit(.:format) > {:action=>"edit", :controller=>"saleries"} > salery GET / > saleries/:id(.:format) > {:action=>"show", :controller=>"saleries"} > PUT / > saleries/:id(.:format) > {:action=>"update", :controller=>"saleries"} > DELETE / > saleries/:id(.:format) > {:action=>"destroy", :controller=>"saleries"} > dashboard_sidebar /dashboard/ > sidebar.:format > {:controller=>"dashboard", :action=>"sidebar"} > /dashboard/ > charts.:format > {:controller=>"dashboard", :action=>"charts"} > /dashboard/ > action_items.:format > {:controller=>"dashboard", :action=>"action_items"} > /dashboard/ > performance.:format > {:controller=>"dashboard", :action=>"performance"} > > So it seems to be contradicting. > > On Sep 4, 3:50 pm, Rodrigo Alves Vieira <rodrig...@gmail.com> wrote: > > > > > > > > > Yeah, in old Rails (2.x) the block created a map variable (you could observe > > "do |map|" in the first line) but in Rails 3 the API has changed and this > > variable is not created anymore, hence you can´t use it. > > > Rodrigo Vieira > > Programmer > > > +55 (81) > > 98935478http://www.rodrigoalvesvieira.comhttps://github.com/rodrigoalvesvieir... > > > On Sun, Sep 4, 2011 at 3:42 PM, John Merlino <stoici...@aol.com> wrote: > > > So I tried using the :as option for the named route so I could have > > > dashboard_sidebar_path helpers. > > > > scope :path => '/dashboard', :controller => :dashboard do > > > match '/sidebar.:format' => :sidebar, :as => 'dashboard_sidebar' > > > match '/charts.:format' => :charts > > > match '/action_items.:format' => :action_items > > > match '/performance.:format' => :performance > > > end > > > > However, strangely enough, it reports this error when using the > > > dashboard_sidebar_path helper: > > > > No route matches {:controller=>"dashboard", :action=>"sidebar"} > > > > As you can see the controller is defined with :controller in the > > > scope, so I dont know why the error. > > > > thanks for response > > > > On Aug 31, 5:42 pm, John Merlino <li...@ruby-forum.com> wrote: > > > > I havent tested it yet but thanks for response > > > > > -- > > > > Posted viahttp://www.ruby-forum.com/. > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Ruby on Rails: Talk" group. > > > To post to this group, send email to rubyonrails-talk@googlegroups.com. > > > To unsubscribe from this group, send email to > > > rubyonrails-talk+unsubscr...@googlegroups.com. > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.