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 anybody help for me 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 -~----------~----~----~----~------~----~------~--~---
this is a mailing list, don''t post the same question several times You must use form_for instead of form_tag or add the id parameter manually <% form_for @editresortbasic do %> But reading your other posts I would recommend working through some basic Rails tutorials, so you understand at least a bit what you are doing here --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi i used the code in editresortbasic.html.erb <% form_for @editresortbasic do %> wizard controller.rb -------------------------------------- def editresortbasic @resort_basic =ResortBasic.find_by_id(params[:id]) if request.post? @resort_basic.update_attributes(params[:resort_basic]) end But i click the edit button and i got the text box empty.Im new in ruby and here im only person doing this application and i can''t understand the error.So i frequently asked the question to you.Thanks for ur help.give any idea? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
there are two main ways to create forms in RoR: - use the helpers that end with _tag, those create "pure" html tags and are not too much aware of objects contents (like @editresortbasic) - use it like that: in the controllers edit action get @editresortbasic like: def edit @resort_basic = ResortBasic.find(params[:id]) # this assumes, that the id of the ResortBasic to be edited is handed to this action end then you can built your view like this: <% form_for @resort_basic do |f| %> <%= f.text_field :name %> <% end %> That way the form "knows" of the @resort_basic object and using the textfield that way, Rails knows that it''s linked to this object and reads the value from @resort_basic.name Same for all the other fields in your form that are columns in the resort_basics table. you can read many details about that in all RoR online tutorials, and you should (must) get comfortable with that kind of Rails syntax. There is not much sense in starting a project without knowing at least the basic syntax of the framework. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You are passing params[:id] as argument to find, so no need to use find_by_id. Its enough to use @resort_basic =ResortBasic.find(params[: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 -~----------~----~----~----~------~----~------~--~---
Hi i used the same code but i got the error: controller code: -------------------------------------------------------------------- def edit @resort_basic =ResortBasic.find(params[:id]) end View code: ---------------------------------------------------------------------------- <% form_for(@resort_basic) do|f| %> <br><br> <h3 align="center">Edit Resort Basic</h3> <table align="center"> <tr> <td> <b>Resort Name</b> </td> <td> <%=f.text_field :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> <%=f.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> <%=f.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> <%=f. text_field :website %> </td> </tr> </table> <table align="center"> <tr> <td> <%=f.submit "Next",:class =>''myButton'' %> </td> </tr> </table> <% end %> I got the controller bugs: ---------------------------------------------- ActiveRecord::RecordNotFound in WizardController#edit Couldn''t find ResortBasic without an ID RAILS_ROOT: D:/RubyProjects/TestEcohols Application Trace <http://localhost:3000/wizard/edit#> | Framework Trace<http://localhost:3000/wizard/edit#>| Full Trace <http://localhost:3000/wizard/edit#> 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 `edit'' :1:in `start'' def edit Error in line: @resort_basic =ResortBasic.find(params[:id]) end I used the same code but i got the bugs.so i can''t understand the error.Help for me and give link ruby on rails tutorials Thanks On 12/10/08, Thorsten Müller <thorsten-1oxKqHKwyltBDgjK7y7TUQ@public.gmane.org> wrote:> > > there are two main ways to create forms in RoR: > - use the helpers that end with _tag, those create "pure" html > tags and are not too much aware of objects contents (like > @editresortbasic) > - use it like that: > > in the controllers edit action get @editresortbasic like: > > def edit > @resort_basic = ResortBasic.find(params[:id]) > # this assumes, that the id of the ResortBasic to be edited is > handed to this action > end > > then you can built your view like this: > > <% form_for @resort_basic do |f| %> > <%= f.text_field :name %> > <% end %> > > That way the form "knows" of the @resort_basic object > and using the textfield that way, Rails knows that it''s linked > to this object and reads the value from @resort_basic.name > Same for all the other fields in your form that are columns > in the resort_basics table. > > you can read many details about that in all RoR online tutorials, > and you should (must) get comfortable with that kind of Rails syntax. > There is not much sense in starting a project without knowing > at least the basic syntax of the framework. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
What does the link which directs you to the edit method for the WizardS Controller look like? You aren''t getting an ID passed in the params. Your edit.html.erb code has nothing to do with this error, this comes from the form that is going TO the edit view. How is the link TO the edit form spec''ed? I assume you''re currently on an index or show view... -- 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 -~----------~----~----~----~------~----~------~--~---