I am working on a Rails app and need some help with coffeescript which I'm not very good at.
I have a form with a field called location_id
using a collection in Rails.
<%= f.grouped_collection_select :location_id, Region.order(:area), :active_locations, :area, :id, :location_name_with_address, {include_blank: true}, class: 'select' %>
On the Location
model there is a column named modifier
which holds a value. Within my form I need to be able to grab the modifier
value to evaluate it client-side to display/hide a div.
I'm starting to write my coffeescript and am able to get the id
of the Location
like this
$('#call_location_id').val()
But what I'm unsure of how to do is, how do I grab that id
of the location, and evaluate the model attribute modifier
? I'm not sure how to grab it on the client side.
I've googled and have read a lot of coffeescript snippets but can't seem to find the right direction to take.
I just need a bump in the right path so I can figure the rest out on my own.
Aucun commentaire:
Enregistrer un commentaire