(Mac OS X 10.51, Rails 2.0.2) I''m trying to get my feet wet with a simple user registration form. Username, password, and email. I went through the motions of creating a static scaffold (well there are no dynamic scaffolds in 2.0, right?). In doing so, Rails created a members_controller, model, and all the views. My thinking was to basically mimic the "new.html.erb" by creating a register.html.erb and duplicate the code. Then I went to the members_controller and added a register method that was a carbon copy of the "new" method. But when I navigate over to http://localhost:3000/members/register I get the following error: ActiveRecord::RecordNotFound in MembersController#show Couldn''t find Member with ID=register I''m a little confused why it''s barking at the method "show". Can someone help clear this up for me? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hello, I''m new to RoR, too. It is hard to find good tutorials online, but I found an awesome user authentication tut, located here: http://codingbitch.com/p/comboy/User+authentication+in+Ruby+on+Rails Also, you should read up on MVC (model, view, controller). Here is a great article: http://www.slash7.com/articles/2005/02/22/mvc-the-most-vexing-conundrum The second one is really good, I really recommend it. She has other articles, too. Good Luck, - Jeff Miller longint wrote:> (Mac OS X 10.51, Rails 2.0.2) > > I''m trying to get my feet wet with a simple user registration form. > Username, password, and email. I went through the motions of creating > a static scaffold (well there are no dynamic scaffolds in 2.0, > right?). In doing so, Rails created a members_controller, model, and > all the views. > > My thinking was to basically mimic the "new.html.erb" by creating a > register.html.erb and duplicate the code. Then I went to the > members_controller and added a register method that was a carbon copy > of the "new" method. But when I navigate over to > http://localhost:3000/members/register > I get the following error: > > ActiveRecord::RecordNotFound in MembersController#show > Couldn''t find Member with ID=register > > I''m a little confused why it''s barking at the method "show". Can > someone help clear this up for me? Thanks.-- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Jeff, I will look into those more. I would also like to say that although http://localhost:3000/members/register throws an error, http://localhost:3000/members/register/i_can_put_anything_here_and_it_works. Now when I run a scaffold and hit the new link I''ll get: http://localhost:3000/members/new. So I would think that by creating a "register" view and a "register" method in the members controller, that register would work the same?? On Jan 18, 1:47 pm, Jeff Miller <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello, > I''m new to RoR, too. It is hard to find good tutorials online, but I > found an awesome user authentication tut, located here: > > http://codingbitch.com/p/comboy/User+authentication+in+Ruby+on+Rails > > Also, you should read up on MVC (model, view, controller). Here is a > great article: > > http://www.slash7.com/articles/2005/02/22/mvc-the-most-vexing-conundrum > > The second one is really good, I really recommend it. She has other > articles, too. > > Good Luck, > - Jeff Miller > > > > longint wrote: > > (Mac OS X 10.51, Rails 2.0.2) > > > I''m trying to get my feet wet with a simple user registration form. > > Username, password, and email. I went through the motions of creating > > a static scaffold (well there are no dynamic scaffolds in 2.0, > > right?). In doing so, Rails created a members_controller, model, and > > all the views. > > > My thinking was to basically mimic the "new.html.erb" by creating a > > register.html.erb and duplicate the code. Then I went to the > > members_controller and added a register method that was a carbon copy > > of the "new" method. But when I navigate over to > >http://localhost:3000/members/register > > I get the following error: > > > ActiveRecord::RecordNotFound in MembersController#show > > Couldn''t find Member with ID=register > > > I''m a little confused why it''s barking at the method "show". Can > > someone help clear this up for me? Thanks. > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
I have the same problem, but I don''t know how can I fix this. it seems like a routing problem... longint wrote:> Thanks Jeff, I will look into those more. > > I would also like to say that although > http://localhost:3000/members/register > throws an error, > http://localhost:3000/members/register/i_can_put_anything_here_and_it_works. > > Now when I run a scaffold and hit the new link I''ll get: > http://localhost:3000/members/new. So I would think that by creating > a "register" view and a "register" method in the members controller, > that register would work the same?? > > On Jan 18, 1:47�pm, Jeff Miller <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Well at least I''m not the only one :P Just doesn''t make sense. Even when I click on the ''Show'' link it brings up: http://localhost:3000/members/1... I would think it would be http://localhost:3000/members/show/1. At least that''s what I gather from the AWDR book. On Jan 18, 2:53 pm, "K. R." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I have the same problem, but I don''t know how can I fix this. it seems > like a routing problem... > > longint wrote: > > Thanks Jeff, I will look into those more. > > > I would also like to say that although > >http://localhost:3000/members/register > > throws an error, > >http://localhost:3000/members/register/i_can_put_anything_here_and_it.... > > > Now when I run a scaffold and hit the new link I''ll get: > >http://localhost:3000/members/new. So I would think that by creating > > a "register" view and a "register" method in the members controller, > > that register would work the same?? > > > On Jan 18, 1:47�pm, Jeff Miller <rails-mailing-l...-ARtvInVfO7m5VldFQK4jKA@public.gmane.orgt> > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Any other ideas out there? On Jan 18, 2:59 pm, longint <michael.me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Well at least I''m not the only one :P > > Just doesn''t make sense. Even when I click on the ''Show'' link it > brings up:http://localhost:3000/members/1... I would think it would > behttp://localhost:3000/members/show/1. At least that''s what I > gather from the AWDR book. > > On Jan 18, 2:53 pm, "K. R." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > I have the same problem, but I don''t know how can I fix this. it seems > > like a routing problem... > > > longint wrote: > > > Thanks Jeff, I will look into those more. > > > > I would also like to say that although > > >http://localhost:3000/members/register > > > throws an error, > > >http://localhost:3000/members/register/i_can_put_anything_here_and_it.... > > > > Now when I run a scaffold and hit the new link I''ll get: > > >http://localhost:3000/members/new. So I would think that by creating > > > a "register" view and a "register" method in the members controller, > > > that register would work the same?? > > > > On Jan 18, 1:47�pm, Jeff Miller <rails-mailing-l...@andreas-s.net> > > > -- > > 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
yes, look at this episode: http://railscasts.com/episodes/35 longint wrote:> Any other ideas out there?-- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nice find K.R. I listened to about half of it... I wasn''t aware that it was actually a convention to stick to new/edit/etc (although you can customize it). Ok, I don''t feel so bad now. Thanks. On Jan 18, 4:44 pm, "K. R." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> yes, look at this episode:http://railscasts.com/episodes/35 > > longint wrote: > > Any other ideas out there? > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
I''m not a rails guru by any stretch, but I''ll take a shot at trying to explain it as I understand it. When you use script/generate to set up the basic scaffolding, it adds a "map.resources" line for the appropiate controller into your routes.rb which gives you the (6 I believe) basic functions "for free". That''d be index, new, create, destroy, etc. If you want something other than those, you need to set up the routes yourself in the config.rb by using a map.connect in order to tell rails how to connect up a route to an action. You do NOT get those for free and it''s not just a simple matter of putting a def in or dropping a view into place. You have to config the route itself. FWIW, you don''t even have to have an index/show/etc method *defined* in the controller. The default action will render any view you have with the appropriate name by default so if you have an index view, it will render it even without having an index method defined in the controller at all. Try it... you''ll see. Rails gives you a lot for free. It doesn''t give you *everything* though. You still have to do a little bit of work. -- Gary F. longint wrote:> Any other ideas out there? > > On Jan 18, 2:59 pm, longint <michael.me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Well at least I''m not the only one :P >> >> Just doesn''t make sense. Even when I click on the ''Show'' link it >> brings up:http://localhost:3000/members/1... I would think it would >> behttp://localhost:3000/members/show/1. At least that''s what I >> gather from the AWDR book. >> >> On Jan 18, 2:53 pm, "K. R." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >>> I have the same problem, but I don''t know how can I fix this. it seems >>> like a routing problem... >>> longint wrote: >>>> Thanks Jeff, I will look into those more. >>>> I would also like to say that although >>>> http://localhost:3000/members/register >>>> throws an error, >>>> http://localhost:3000/members/register/i_can_put_anything_here_and_it.... >>>> Now when I run a scaffold and hit the new link I''ll get: >>>> http://localhost:3000/members/new. So I would think that by creating >>>> a "register" view and a "register" method in the members controller, >>>> that register would work the same?? >>>> On Jan 18, 1:47�pm, Jeff Miller <rails-mailing-l...@andreas-s.net> >>> -- >>> 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Right Gary - that''s the conclusion I came to after watching the screencast. I''ve been on and off with the AWDR book (maybe 50% through) and I''m probably going to pick up another book to supplement. Thanks. On Jan 18, 4:56 pm, Gary Foster <gary.fos...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m not a rails guru by any stretch, but I''ll take a shot at trying to > explain it as I understand it. > > When you use script/generate to set up the basic scaffolding, it adds a > "map.resources" line for the appropiate controller into your routes.rb > which gives you the (6 I believe) basic functions "for free". That''d be > index, new, create, destroy, etc. > > If you want something other than those, you need to set up the routes > yourself in the config.rb by using a map.connect in order to tell rails > how to connect up a route to an action. You do NOT get those for free > and it''s not just a simple matter of putting a def in or dropping a view > into place. You have to config the route itself. > > FWIW, you don''t even have to have an index/show/etc method *defined* in > the controller. The default action will render any view you have with > the appropriate name by default so if you have an index view, it will > render it even without having an index method defined in the controller > at all. > > Try it... you''ll see. > > Rails gives you a lot for free. It doesn''t give you *everything* > though. You still have to do a little bit of work. > > -- Gary F. > > longint wrote: > > Any other ideas out there? > > > On Jan 18, 2:59 pm, longint <michael.me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Well at least I''m not the only one :P > > >> Just doesn''t make sense. Even when I click on the ''Show'' link it > >> brings up:http://localhost:3000/members/1... I would think it would > >> behttp://localhost:3000/members/show/1. At least that''s what I > >> gather from the AWDR book. > > >> On Jan 18, 2:53 pm, "K. R." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > >>> I have the same problem, but I don''t know how can I fix this. it seems > >>> like a routing problem... > >>> longint wrote: > >>>> Thanks Jeff, I will look into those more. > >>>> I would also like to say that although > >>>>http://localhost:3000/members/register > >>>> throws an error, > >>>>http://localhost:3000/members/register/i_can_put_anything_here_and_it.... > >>>> Now when I run a scaffold and hit the new link I''ll get: > >>>>http://localhost:3000/members/new. So I would think that by creating > >>>> a "register" view and a "register" method in the members controller, > >>>> that register would work the same?? > >>>> On Jan 18, 1:47�pm, Jeff Miller <rails-mailing-l...@andreas-s.net> > >>> -- > >>> 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-/JYPxA39Uh5TLH3MbocFFw@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 Jan 18, 2:12 pm, longint <michael.me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Right Gary - that''s the conclusion I came to after watching the > screencast. I''ve been on and off with the AWDR book (maybe 50% > through) > and I''m probably going to pick up another book to supplement. > > Thanks. > > On Jan 18, 4:56 pm, Gary Foster <gary.fos...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m not a rails guru by any stretch, but I''ll take a shot at trying to > > explain it as I understand it. > > > When you use script/generate to set up the basic scaffolding, it adds a > > "map.resources" line for the appropiate controller into your routes.rb > > which gives you the (6 I believe) basic functions "for free". That''d be > > index, new, create, destroy, etc. > > > If you want something other than those, you need to set up the routes > > yourself in the config.rb by using a map.connect in order to tell rails > > how to connect up a route to an action. You do NOT get those for free > > and it''s not just a simple matter of putting a def in or dropping a view > > into place. You have to config the route itself. > > > FWIW, you don''t even have to have an index/show/etc method *defined* in > > the controller. The default action will render any view you have with > > the appropriate name by default so if you have an index view, it will > > render it even without having an index method defined in the controller > > at all. > > > Try it... you''ll see. > > > Rails gives you a lot for free. It doesn''t give you *everything* > > though. You still have to do a little bit of work. > > > -- Gary F. > > > longint wrote: > > > Any other ideas out there? > > > > On Jan 18, 2:59 pm, longint <michael.me...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> Well at least I''m not the only one :P > > > >> Just doesn''t make sense. Even when I click on the ''Show'' link it > > >> brings up:http://localhost:3000/members/1... I would think it would > > >> behttp://localhost:3000/members/show/1. At least that''s what I > > >> gather from the AWDR book. > > > >> On Jan 18, 2:53 pm, "K. R." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > >>> I have the same problem, but I don''t know how can I fix this. it seems > > >>> like a routing problem... > > >>> longint wrote: > > >>>> Thanks Jeff, I will look into those more. > > >>>> I would also like to say that although > > >>>>http://localhost:3000/members/register > > >>>> throws an error, > > >>>>http://localhost:3000/members/register/i_can_put_anything_here_and_it.... > > >>>> Now when I run a scaffold and hit the new link I''ll get: > > >>>>http://localhost:3000/members/new. So I would think that by creating > > >>>> a "register" view and a "register" method in the members controller, > > >>>> that register would work the same??Rails 2.0 uses RESTful application design, have a look at the section on REST in that book as most of the stuff shown in it is now useless. Google everyhing you can about rest and rails2.0 --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 Fri, 18 Jan 2008 13:56:57 -0800, Gary Foster wrote:> When you use script/generate to set up the basic scaffolding, it adds a > "map.resources" line for the appropiate controller into your routes.rb > which gives you the (6 I believe) basic functions "for free". That''d be > index, new, create, destroy, etc. > > If you want something other than those, you need to set up the routes > yourself in the config.rb by using a map.connect in order to tell rails > how to connect up a route to an action. You do NOT get those for free > and it''s not just a simple matter of putting a def in or dropping a view > into place. You have to config the route itself. > > FWIW, you don''t even have to have an index/show/etc method *defined* in > the controller. The default action will render any view you have with > the appropriate name by default so if you have an index view, it will > render it even without having an index method defined in the controller > at all.How does this relate to creating an interface for has_many :through (if I may shift the topic)? This map relates to the controller how please? thanks, Thufir --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---