Hi,
Again I can't get my head around a simple RoR drop down.
for my first drop down all a need is a simple number list which I have
in the "ascential" controller
def index
@size = [12,13,14,15,16,16.5,17,18,19,212,13,0,21,22,23,24]
end
( I have a tire model and I want to be able to display all my tires
based on the drop down search criteria from the "ascential" index view)
when I've looked up ruby and selects in most all are in a form_for.
I don't know why I would need a form_for in this case.
Form_for refers to a model. But I have no model I need to refer to I
simpley want these options to be shown, which I can do from an array. In
my index I have
<div id="by_size">
Size:
<select id="search_size">
<% for size in @size %>
<option><%=h size %>"</option>
<%end%>
</select>
<div id="search_button"><%= link_to 'Search' ,:controller =>
"ascential", :action => "tire_result", :id => 16%></div>
This gives me a drop down with the options filled with the correct
numbers. I need to figure out how to get :id to equal the selected index
of "search_size"
my brain wants to see some thing like " :id =>
search_size.selected_index"
but I don't know how ruby calls selected indexes with out the form_for.
So if I have to use Form_for ...to do drop downs... then I have to refer
to a model. So would I put the @size array in a "ascentail" model and
refer to it
how do I structure a form_for that isn't submiting any thing..
SO I think that I have set it up all wrong but I can't seem to get my
head around how to start it.
the link_to works if :id equals a number
Or should I just make it all javascript. how would I apply a strictly
javascript selected index to a ror method?
Yikes this is bad
--
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@googlegroups.com.
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.
No comments:
Post a Comment