Forum: Ruby on Rails problem in update

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Balaji R. (Guest)
on 2008-12-19 06:29
(Received via mailing list)
Hi

im using five forms(5 pages) and one controller.select the edit form1
page
values displayed but i change values after updated but not change the
values
in database .only already values stored.

view code
------------------------------
-----------------------------------------------------editresortadditionaldetails.html

<% form_tag :action => 'update',:controller=>'Wizard',:id=>@id do %>

 <br><br>

  <h3 align="center">Edit Resort Additional Detail</h3>
  <table align="center">
    <!--tr>
        <td>
           <b>Resort</b>
        </td>
        <td>

            <!--%=f.collection_select(:resortid,
ResortBasic.find(:all),:id,:resortname)%>
        </td>
    </tr-->
    <tr>
        <td>
           <b>Amenities</b>
       </td>
       <td>
         <%=text_area_tag
@resort_additionaldetail.aminity,@resort_additionaldetail.aminity%>
       </td>
    </tr>
     <tr>
        <td>
          <b>Directions</b>
        </td>
        <td>

            <%=text_field_tag
@resort_additionaldetail.directions,@resort_additionaldetail.directions
%>
        </td>
    </tr>
    <tr>
        <td>
           <b>Transport</b>
       </td>
       <td>
           <%=text_field_tag
@resort_additionaldetail.transport,@resort_additionaldetail.transport %>
       </td>
    </tr>
     <tr>
        <td>
           <b>Map</b>
        </td>
        <td>

            <%=text_field_tag
@resort_additionaldetail.map,@resort_additionaldetail.map %>
        </td>
    </tr>
    <tr>
        <td>
           <b>Pickup Offered</b>
       </td>
       <td>
           <%=text_field_tag
@resort_additionaldetail.pickupoffered,@resort_additionaldetail.pickupoffered
%>
       </td>
    </tr>
     <tr>
        <td>
           <b>Email</b>
        </td>
        <td>

           <%=text_field_tag
@resort_additionaldetail.email_id,@resort_additionaldetail.email_id %>
        </td>
    </tr>

 </table>
 <table align="center">
    <tr>
       <td>
            <%=submit_tag "Update" ,:class =>'myButton' %>


       </td>

    </tr>
 </table>

<% end %>


controller code


 def editresortbasics
   # render :text =>params[:resortname]

  # @resort_basic.resortname=params[:resortname]
     # logger.debug(params[:id])
 session[:editresort_id]=params[:id]
  @id = session[:editresort_id]
  @resort_basic =ResortBasic.find(@id)


  #if request.post?
  # @resort_basic.update_attributes(params[:resort_basic])
  #      flash[:notice] = 'Resort was successfully updated.'
  # redirect_to :action => 'editresortbasic',
  session[:resort_basic]=@resort_basic
 # session[:editresort_id]=params[:id]
  render :action=> "editresortbasic"
 # redirect_to(@resort_contactdetail)
  end

  def editresortcontacts

  @id = session[:editresort_id]
   #render :text =>@id
   @resort_contactdetail =ResortContactdetail.find(@id)
     session[:resort_contact]=@resort_contactdetail
      render :action => "editresortcontact"
  end

  def editresortaddresses
    @id = session[:editresort_id]
    @resort_address =ResortAddress.find(@id)

    session[:resort_address]= @resort_address

   render :action => "editresortaddress"
  end
   def editresortaccomodations
      @id = session[:editresort_id]
     @resort_accomodation =ResortAccomodation.find(@id)
   session[:resort_accomodation]= @resort_accomodation
   render :action => "editresortaccomodation"
   end
  def editresortadditional
  @id = session[:editresort_id]
  @resort_additionaldetail =ResortAdditionaldetail.find(@id)
   render :action => "editresortadditionals"
  end

  def update

  # @resort_basic =ResortBasic.find(params[:id])
  # @resort_basic =  session[:resort_basic]
  # @resort_basic.update_attributes(params[:resort_basic])

   #@resort_contactdetail =ResortContactdetail.find(params[:id])
  # @resort_address =ResortAddress.find(params[:id])
  # @resort_accomodation =ResortAccomodation.find(params[:id])
   @resort_additionaldetail =ResortAdditionaldetail.find(params[:id])
  # render:text=>params[:id]
   #if request.post?

  # @resort_contactdetail =  session[:resort_contact]
   #@resort_contactdetail.update_attributes(params[:resort_contact])
  # @resort_address =  session[:resort_address]
  # @resort_address.update_attributes(params[:resort_address])
  # @resort_accomodation =  session[:resort_accomodation]
 #  @resort_accomodation.update_attributes(params[:resort_accomodation])

  if
@resort_additionaldetail.update_attributes(params[:resort_additional])
    # render:text=>params[:resort_additional]
   # flash[:notice] = 'Add Resort was successfully updated.'
   render :action => "resortupdated"
 #redirect_to(@resort_additionaldetail)
  end

Values not updated in database.give idea and any one help for me

Thanks
Balaji
This topic is locked and can not be replied to.