Ronald Fischer
2014-May-23 13:04 UTC
Beginner's routing question: Redirecting to a different controller
I have a problem passing control from one controller to the next. Here
are the details:
I have a model 'Dict' with primary key :dictname. I have two
controllers, named 'Login' and 'Dict'. The application starts in
views/login/index.html.erb, where I have - among other stuff - an entry
field for the dictname. When clicking a button, control passes to a
method in login_controller.rb, where various authentification is being
performed.
If all checks pass, control should now be transfered to a page
views/dict/manage.html.erb , and this page should receive the dictname
as a parameter.
Here is what I have tried so far:
In routes.rb I placed an entry
get 'dict/:id/manage', to: 'dict#manage'
In login_controller.rb, I tried to transfer the controll with
redirect_to dict_path(@dict)
However, I get the error message
'undefined method dict_path'
I thought that dict_path should be a helper method, which is generated
out of my routes.rb . Since this method is undefined, I suspect that my
routes.rb is not correct.
Note that I did NOT place a
resources :dicts
into routes.rb, because - for the time being - I don't need yet the full
set of CRUD capabilities on a Dict, so I thought I'll just start with
the minimum needed, and extend over the time as necessary. If you think
that this is an unwise decision, please let me know.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/b67980df9f40488cdb667561c9b24faa%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.