i have one controller users. that have one method login and create method.
i have to call that login method. but when i call using the firefox
restclient that going to create method..?
*
*
*class UsersController*
*def create *
*
*
*end*
*def login*
* *
* logger.info("method login ")*
* end*
*end*
*
*
*routes.rb*
*
*
* *match "/users/login", :controller => ''users'',
:action => ''login'', :via
=> [:post]
resources :users
*
*
*
*
*In mozilla restclient plugin*
*
*
*method*: post
*Url*: http://localhost:3000/users/login
i got the error like this
Started POST "/users/login" for 127.0.0.1 at 2012-03-01 15:56:11 +0530
Processing by UsersController#create as JSON
Parameters: {"name"=>"name",
"id"=>"login",
"user"=>{"id"=>"login",
"name"=>"name"}}
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/jrQD1Z5XG0kJ.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On 1 March 2012 10:45, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> i have one controller users. that have one method login and create method. i > have to call that login method. but when i call using the firefox restclient > that going to create method..? > > class UsersController > def create > > end > def login > > logger.info("method login ") > end > end > > routes.rb > > match "/users/login", :controller => ''users'', :action => ''login'', :via => > [:post] > resources :users > > > In mozilla restclient plugin > > > method: post > Url: http://localhost:3000/users/login > > > > i got the error like this > > Started POST "/users/login" for 127.0.0.1 at 2012-03-01 15:56:11 +0530 > Processing by UsersController#create as JSON > Parameters: {"name"=>"name", "id"=>"login", "user"=>{"id"=>"login", > "name"=>"name"}}Did you remember to restart the server after changing routes.rb? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 1 March 2012 11:29, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Thursday, 1 March 2012 16:25:46 UTC+5:30, Colin Law wrote: >> >> On 1 March 2012 10:45, amvis <vgrkrishnan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > i have one controller users. that have one method login and create >> > method. i >> > have to call that login method. but when i call using the firefox >> > restclient >> > that going to create method..? >> > >> > class UsersController >> > def create >> > >> > end >> > def login >> > >> > logger.info("method login ") >> > end >> > end >> > >> > routes.rb >> > >> > match "/users/login", :controller => ''users'', :action => ''login'', :via >> > => >> > [:post] >> > resources :users >> > >> > >> > In mozilla restclient plugin >> > >> > >> > method: post >> > Url: http://localhost:3000/users/login >> > >> > >> > >> > i got the error like this >> > >> > Started POST "/users/login" for 127.0.0.1 at 2012-03-01 15:56:11 +0530 >> > Processing by UsersController#create as JSON >> > Parameters: {"name"=>"name", "id"=>"login", "user"=>{"id"=>"login", >> > "name"=>"name"}} >> >> >Did you remember to restart the server after changing routes.rb? >> >> Colin > > yes, just its working...Do you mean that you have now restarted the server and it is working? Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
All the time, when you use POST you will be directed to create action(if you use resources). If you need to add some method to resource routing, use resources :users do get "some", :on => :member end But in your case it''s better to use before_filter before_filter :login def login ... end On Mar 1, 12:45 pm, amvis <vgrkrish...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> i have one controller users. that have one method login and create method. > i have to call that login method. but when i call using the firefox > restclient that going to create method..? > * > * > *class UsersController* > *def create * > * > * > *end* > *def login* > * * > * logger.info("method login ")* > * end* > *end* > * > * > *routes.rb* > * > * > * *match "/users/login", :controller => ''users'', :action => ''login'', :via > => [:post] > resources :users > * > * > * > * > *In mozilla restclient plugin* > * > * > > *method*: post > *Url*:http://localhost:3000/users/login > > i got the error like this > > Started POST "/users/login" for 127.0.0.1 at 2012-03-01 15:56:11 +0530 > Processing by UsersController#create as JSON > Parameters: {"name"=>"name", "id"=>"login", "user"=>{"id"=>"login", > "name"=>"name"}}-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.