Hello,
I am new to Ruby and Rails.
I have a _form.html where there are 2 drop down lists. The first one
shows a list of categories and the second dropdown shows a list of
sub-categories.
How can I get the values of the second dropdown based on what the user
selected in the first dropdown list ?
Is the "merchant_account" object available in a variable in this form
automatically or do I have to create it by assignment ?
--------------------------------------------------
<tr><td><label
for="merchant_account_business_category">Business
category:</label>
</td><td><%= options = [["Select a business category",
""]] +
BusinessCategory.find_all.collect { |x| [x.business_category, x.id] }
select("merchant_account", "business_category_fk",
options )
%></td>
</tr>
</tr>
<tr><td><label
for="merchant_account_business_sub_category">Business sub
category:</label>
<td><%= options = [["Select a business sub category",
""]] + <HOW DO I
GET THE LIST OF SUB-CATEGORIES HERE for the SELECTED BUSINESS CATEGORY
?>
select("merchant_account", "business_sub_category",
options )
%>
</td>
---------------------------------------------
Any help would be appreciated.
--
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
-~----------~----~----~----~------~----~------~--~---