Hi.
I am new in ruby on rails..............
Im using Two tables. one is Resortclass and another is Resortbasic.
Resortclass table using masterpage.View
<br><br>
<h3 align="center">Resort Classes</h3>
<table align="center">
<tr>
<td>
<%= paginating_links(@resort_classes) %>
</td>
</tr>
</table>
<table align="center" border="1" cellpadding="5" cellspacing="0">
<tr>
<th>Resort Class</th>
<th>Action</th>
</tr>
<ol>
<% @resort_classes.each do |resort_class| %>
<tr>
<td class="text1"><%=h resort_class.resortclass %></td>
<td class="text1">
<%= link_to 'Show', resort_class %>
<%= link_to 'Edit', edit_resort_class_path
(resort_class) %>
<%= link_to 'Destroy', resort_class, :confirm
=> 'Are you sure?', :method => :delete %>
</td>
</tr>
<% end %>
</ol>
</table>
<table align="center">
<tr>
<td>
<%= button_to 'Add', new_resort_class_path,:class=>'myButton'%>
</td>
</tr>
</table>
Resortclass is working and i need to the corresponding resortid value
and Im using five form and different tables and one controller is
Wizard controller
Resortbasic View Page
<% form_tag :action => 'wizard', :stage => @next_stage do %>
<br><br>
<h3 align="center">Add 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 %>
Wizard controller
class WizardController < ApplicationController
def wizard
if params[:stage].nil?
@stage = 1
@resort_basic = ResortBasic.new {}
@resort_basic.resortclassid=params[:resortclass];
@resort_basic.resortname=params[:resortname];
@resort_basic.resorttypeid=params[:resorttype];
@resort_basic.seasonid=params[:seasontype];
@resort_basic.website=params[:website];
@resort_basic.save()
session[:resort_basicObj] = @resort_basic # Or whatever model
is storing your stuff
else
@stage = params[:stage].to_i
@dummyObj = session[:resort_basicObj];
@dummyObj.save()
@resort_contactdetail = ResortContactdetail.new{}
@[EMAIL PROTECTED]
@resort_contactdetail.firstname= params[:firstname]
@resort_contactdetail.lastname= params[:lastname]
@resort_contactdetail.designation= params[:designation]
@resort_contactdetail.email_id= params[:email_id]
@resort_contactdetail.mobile= params[:mobile]
@resort_contactdetail.telephone1= params[:telephone1]
@resort_contactdetail.telephone2= params[:telephone2]
@resort_contactdetail.fax= params[:fax]
# @resort_contactdetail.save()
end
@next_stage = @stage + 1
[EMAIL PROTECTED] = session[:wizard_data]
render :template => 'wizard\\stage'[EMAIL PROTECTED]
end
end
But i got the resortname and website value and i didn't get
resortclassid,resorttypeid value.
To store the combo box id value from one table another table in mysql
database+ruby on rails........................
Please help me...........
Thanks &Regards
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---