balaji rajagopal
2008-Dec-09 09:01 UTC
Edit the form and produced Couldn''t find ResortBasic without an ID
Hi Im using the 5 views and one controller.To edit the form and produced Couldn''t find ResortBasic without an ID View code .........................................editresortbasic.html.erb <% form_tag :action => ''editresortbasic'',:controller=>''Wizard'' do %> <br><br> <h3 align="center">Edit Resort Basic</h3> <table align="center"> <tr> <td> <b>Resort Name</b> </td> <td> <%= text_field_tag :resortname %> </td> </tr> <tr> <td> <b>Resort Type</b> </td> <td> <!--%=f.collection_select(resort_basic.resorttypeid, ResortType.find(:all),id,resorttype)%--> <%=select("resorttype", "resorttypeid", ResortType.find(:all).collect {|p| [ p.resorttype, p.id ] })%> </td> </tr> <tr> <td> <b>Resort Class</b> </td> <td> <!--%=collection_select(:resortclassid, ResortClass.find(:all),:id,:resortclass)%--> <%=select("resortclass", "resortclassid", ResortClass.find(:all).collect {|p| [ p.resortclass, p.id ] })%> </td> </tr> <tr> <td> <b>Season</b> </td> <td> <!--%=collection_select(:seasonid, Season.find(:all),:id,:seasontype)%--> <%=select("seasontype", "seasontypeid", Season.find(:all).collect {|p| [ p.seasontype, p.id ] })%> </td> </tr> <tr> <td> <b>Website</b> </td> <td> <%= text_field_tag :website %> </td> </tr> </table> <table align="center"> <tr> <td> <%= submit_tag "Next",:class =>''myButton'' %> </td> </tr> </table> <% end %> controller code..... def editresortbasic @resort_basic = ResortBasic.find(params[:id]) if request.post? @resort_basic.update_attributes(params[:resort_basic]) # flash[:notice] = ''City was successfully updated.'' # render :action=>''editresortcontact'' end but i got the bugs ------------------------ ActiveRecord::RecordNotFound in WizardController#editresortbasic Couldn''t find ResortBasic without an ID RAILS_ROOT: D:/RubyProjects/TestEcohols Application Trace <http://localhost:3000/wizard/editresortbasic#> | Framework Trace <http://localhost:3000/wizard/editresortbasic#> | Full Trace<http://localhost:3000/wizard/editresortbasic#> D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1248:in `find_from_ids'' D:/Program Files/NetBeans 6.1/ruby2/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:504:in `find'' vendor/plugins/paginating_find/lib/paginating_find.rb:103:in `find_with_pagination'' app/controllers/wizard_controller.rb:233:in `editresortbasic'' :1:in `start'' So give any idea or solution thanks balaji --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
MaD
2008-Dec-09 11:06 UTC
Re: Edit the form and produced Couldn''t find ResortBasic without an ID
i think your params[:id] does not get set in your view. so whenever you hit the submit-button, you get that error. maybe i''m missing something, but a debugger at the beginning of your method-body in your controller should help clearify that issue. MaD --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
balaji rajagopal
2008-Dec-09 11:49 UTC
Re: Edit the form and produced Couldn''t find ResortBasic without an ID
Hi im using edit form and i got error ActiveRecord::RecordNotFound in WizardController#editresortbasic Couldn''t find ResortBasic without an ID controller code Error in line: @resort_basic =ResortBasic.find(params[:id]) if anybody know give idea debugger the code using in view page <%= debug(params)%> and i got the error : --- !map:HashWithIndifferentAccess controller: wizard action: editresortbasic Thanks On 12/9/08, MaD <mayer.dominik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > i think your params[:id] does not get set in your view. so whenever > you hit the submit-button, you get that error. > > maybe i''m missing something, but a debugger at the beginning of your > method-body in your controller should help clearify that issue. > > MaD > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ar Chron
2008-Dec-09 14:43 UTC
Re: Edit the form and produced Couldn''t find ResortBasic without an ID
You obviously don''t have the :id available... Why don''t you just run your app, go to edit a resort, and view the page source generated for that first page (step 1 in your wizard?). What does the form element on the rendered page look like? Does it mention the current resort_basic id? -- 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 -~----------~----~----~----~------~----~------~--~---
balaji rajagopal
2008-Dec-10 09:28 UTC
Re: Edit the form and produced Couldn''t find ResortBasic without an ID
Hi Im using the 5 views and one controller.To edit the form and produced Couldn''t find ResortBasic without an ID View code .........................................editresortbasic.html.erb <% form_tag :action => ''editresortbasic'',:controller=>''Wizard'' do %> <br><br> <h3 align="center">Edit Resort Basic</h3> <table align="center"> <tr> <td> <b>Resort Name</b> </td> <td> <%= text_field_tag :resortname %> </td> </tr> <tr> <td> <b>Resort Type</b> </td> <td> <!--%=f.collection_select(resort_basic.resorttypeid, ResortType.find(:all),id,resorttype)%--> <%=select("resorttype", "resorttypeid", ResortType.find(:all).collect {|p| [ p.resorttype, p.id ] })%> </td> </tr> <tr> <td> <b>Resort Class</b> </td> <td> <!--%=collection_select(:resortclassid, ResortClass.find(:all),:id,:resortclass)%--> <%=select("resortclass", "resortclassid", ResortClass.find(:all).collect {|p| [ p.resortclass, p.id ] })%> </td> </tr> <tr> <td> <b>Season</b> </td> <td> <!--%=collection_select(:seasonid, Season.find(:all),:id,:seasontype)%--> <%=select("seasontype", "seasontypeid", Season.find(:all).collect {|p| [ p.seasontype, p.id ] })%> </td> </tr> <tr> <td> <b>Website</b> </td> <td> <%= text_field_tag :website %> </td> </tr> </table> <table align="center"> <tr> <td> <%= submit_tag "Next",:class =>''myButton'' %> </td> </tr> </table> <% end %> controller code..... ----------------------------------------------- def editresortbasic @resort_basic = ResortBasic.find(params[:id]) if request.post? @resort_basic.update_attributes(params[:resort_basic]) # flash[:notice] = ''City was successfully updated.'' # render :action=>''editresortcontact'' end In controller code now i used ----------------------------------------------------------------- def editresortbasic @resort_basic = ResortBasic.find_by_id (params[:id]) if request.post? @resort_basic.update_attributes(params[:resort_basic]) flash[:notice] = ResortBasic was successfully updated.'' # render :action=>''editresortcontact'' end but i select the edit button and got the text only .values are not diaplay.so give any idea. Thanks for ur help On 12/9/08, Ar Chron <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > You obviously don''t have the :id available... > > Why don''t you just run your app, go to edit a resort, and view the page > source generated for that first page (step 1 in your wizard?). > > What does the form element on the rendered page look like? Does it > mention the current resort_basic id? > > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Thorsten Müller
2008-Dec-10 09:39 UTC
Re: Edit the form and produced Couldn''t find ResortBasic without an ID
If you post one and the same question several times, you could at least have a look at the responses for each post: http://groups.google.ca/group/rubyonrails-talk/browse_thread/thread/4c0625da76c0a962/45b7ccb765e66bf4#45b7ccb765e66bf4 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---