Hello,
Again,quite new to Ruby on Rails and Ajax, both. I heard it is supposed to be quite easy to add Ajax stuff into the web sites, and since my forms are somewhat done, I thought I would give it a try.
But there are some problems, unfortunately, that I could not really find the fitting documentation. I tried with the only method I found suitable observe_field
, and it creates some JavaScript code which does nothing.
So basically, I wanted to ask for a general way how to do that. This is the select I want to observe:
<div class="field"><%= collection_select :species_id,
Species.all, :id, :name %></div>
<%# Ruby-Ajax goes here? %>
<div id="species-preview"><%= render :partial => 'species/species' %></div>
So yes, what I want to do is: Whenever the user selects another species, the second should show a little preview about it.
I read the docs and searched here for examples, but it all left me kind of confused. So thanks for your time.