users_controller :-- def show @user = User.find(params[:id]) end show.html.erb :-- <h1>Showing user</h1> <p><th>Name</th>: <%=h @user.name%></p> <p><th>Role</th>: <%=h @user.role%></p> <p><th>Password</th>: <%=h @user.password%></p> <p><th>Confirmation Password</th>: <%=h @user.confirmation_password%></ p> <%= link_to ''Back'', :action =>''list'' %> Error : ActiveRecord::RecordNotFound in UsersController#show Couldn''t find User without an ID Please help it must help full for edti.html.erb -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 28 February 2010 07:47, ashu <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> users_controller :-- > > def show > @user = User.find(params[:id]) > end > > show.html.erb :-- > > <h1>Showing user</h1> > <p><th>Name</th>: <%=h @user.name%></p> > <p><th>Role</th>: <%=h @user.role%></p> > <p><th>Password</th>: <%=h @user.password%></p> > <p><th>Confirmation Password</th>: <%=h @user.confirmation_password%></ > p> > <%= link_to ''Back'', :action =>''list'' %> > > Error : > ActiveRecord::RecordNotFound in UsersController#show > > Couldn''t find User without an ID > Please help it must help full for edti.html.erbNote that the error is in UsersController#show so it is nothing to do with show.html.erb as it has not got there yet. Since all you are doing in show is finding a record by id and the error says that the record was not found it seems likely that the error is with params[:id]. Have a look in development.log and see what parameters are being passed to show. 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.
Processing UsersController#show (for 127.0.0.1 at 2010-02-28 18:58:49) [GET] Session ID: BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo SGFzaHsABjoKQHVzZWR7AA==--56987cc63590eb878c021fb10e6d0bdf10f5b4f4 Parameters: {"action"=>"show", "controller"=>"users"} ActiveRecord::RecordNotFound (Couldn''t find User without an ID): E:/Rails_instanT/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:1364:in `find_from_ids'' E:/Rails_instanT/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:541:in `find'' /app/controllers/users_controller.rb:3:in `show'' On 2/28/10, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 28 February 2010 07:47, ashu <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> users_controller :-- >> >> def show >> @user = User.find(params[:id]) >> end >> >> show.html.erb :-- >> >> <h1>Showing user</h1> >> <p><th>Name</th>: <%=h @user.name%></p> >> <p><th>Role</th>: <%=h @user.role%></p> >> <p><th>Password</th>: <%=h @user.password%></p> >> <p><th>Confirmation Password</th>: <%=h @user.confirmation_password%></ >> p> >> <%= link_to ''Back'', :action =>''list'' %> >> >> Error : >> ActiveRecord::RecordNotFound in UsersController#show >> >> Couldn''t find User without an ID >> Please help it must help full for edti.html.erb > > Note that the error is in UsersController#show so it is nothing to do > with show.html.erb as it has not got there yet. Since all you are > doing in show is finding a record by id and the error says that the > record was not found it seems likely that the error is with > params[:id]. Have a look in development.log and see what parameters > are being passed to show. > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Thanks: Rajeev sharma -- 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 28 February 2010 13:30, kannav rajeev <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Processing UsersController#show (for 127.0.0.1 at 2010-02-28 18:58:49) [GET] > Session ID: BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo > SGFzaHsABjoKQHVzZWR7AA==--56987cc63590eb878c021fb10e6d0bdf10f5b4f4 > Parameters: {"action"=>"show", "controller"=>"users"}Can you not see the problem? There is no id in the parameters. Given that it is not surprising that User.find(params[:id]) fails saying that there is no id. Colin> > > ActiveRecord::RecordNotFound (Couldn''t find User without an ID): > E:/Rails_instanT/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:1364:in > `find_from_ids'' > E:/Rails_instanT/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:541:in > `find'' > /app/controllers/users_controller.rb:3:in `show'' > > On 2/28/10, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 28 February 2010 07:47, ashu <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> users_controller :-- >>> >>> def show >>> @user = User.find(params[:id]) >>> end >>> >>> show.html.erb :-- >>> >>> <h1>Showing user</h1> >>> <p><th>Name</th>: <%=h @user.name%></p> >>> <p><th>Role</th>: <%=h @user.role%></p> >>> <p><th>Password</th>: <%=h @user.password%></p> >>> <p><th>Confirmation Password</th>: <%=h @user.confirmation_password%></ >>> p> >>> <%= link_to ''Back'', :action =>''list'' %> >>> >>> Error : >>> ActiveRecord::RecordNotFound in UsersController#show >>> >>> Couldn''t find User without an ID >>> Please help it must help full for edti.html.erb >> >> Note that the error is in UsersController#show so it is nothing to do >> with show.html.erb as it has not got there yet. Since all you are >> doing in show is finding a record by id and the error says that the >> record was not found it seems likely that the error is with >> params[:id]. Have a look in development.log and see what parameters >> are being passed to show. >> >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> > > > -- > Thanks: > Rajeev sharma > > -- > 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. > >-- 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.