<% @people = Person.find(:all) %>
<%= javascript_include_tag "prototype" %>
<%= collection_select :person, :id, @people, :id, :firstname,
{:include_blank => false},
{:onchange => remote_function(:url => {:action => 'say_hello'},
:with => "'id=' + this.value",
:update => "mydiv")} %>
<div id="mydiv">
<%= render :partial => "people/show"%>
</div>
In controller
def say_hello
@person = Person.find(params[:id])
render :partial => "people/show"
end
Taken From : http://www.ruby-forum.com/topic/187488 [RoR & Ajax]
Other Resource : http://delta-knight.co.uk/jump-to.shtml [HTML & JS]
drop down example in rubyon rails 4 with one to many relation table and insert to db.......cal any body help me to solve this situation
ReplyDelete