Edit the form


#1

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 %>



Edit Resort Basic


<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 ] })%>





Resort Name
        <%= 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 ] })%>


Website

<%= text_field_tag :website %>
   <td>

        <%= submit_tag "Next",:class =>'myButton' %>
 </td>

</tr>
<% 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
Tracehttp://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:infind’
vendor/plugins/paginating_find/lib/paginating_find.rb:103:in
find_with_pagination' app/controllers/wizard_controller.rb:233:ineditresortbasic’
:1:in `start’

So anybody help for me

thanks

balaji


#2

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