You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am new to letsrate gem and also saw existing bugs. No one post the issue like this. In order to avoid ajax call, I am customized letsrate.js.erb for form submission. Setting the values of letsrate scores, dimensions and klass in hidden fields. Till now everything works fine for me.
In Review model:
letsrate_rateable "speed"
In letsrate.js.erb:
click: function(score, evt) {
var _this = this;
$("#business_rate_score").attr("value", score); $("#business_rate_dimension").attr("value", $(this).attr('data-dimension')); $("#business_rate_klass").attr("value", $(this).attr('data-classname'));
}
When am trying to use field_for and use those hidden fields like this:
<%= f.fields_for :rates do |g| %>
input type='hidden' id="business_rate_score" name="score"
input type='hidden' id="business_rate_dimension" name="dimension"
input type='hidden' id="business_rate_klass" name="klass"
<% end %>
For making nested_attributes in Review model:
letsrate_rateable "speed"
accepts_nested_attributes_for :rates, :allow_destroy => true
It throws No association found for name `rates'. Has it been defined yet? (ArgumentError)
Is letsrate gem accepting nested attributes? Can you explain me to make nested attributes to save the values?
The text was updated successfully, but these errors were encountered:
Issue by railsfactory-bharani
Thursday May 29, 2014 at 16:23 GMT
Originally opened as muratguzel#71
I am new to letsrate gem and also saw existing bugs. No one post the issue like this. In order to avoid ajax call, I am customized letsrate.js.erb for form submission. Setting the values of letsrate scores, dimensions and klass in hidden fields. Till now everything works fine for me.
In Review model:
letsrate_rateable "speed"
In letsrate.js.erb:
$("#business_rate_dimension").attr("value", $ (this).attr('data-dimension'));
$("#business_rate_klass").attr("value", $ (this).attr('data-classname'));
click: function(score, evt) {
var _this = this;
$("#business_rate_score").attr("value", score);
}
When am trying to use field_for and use those hidden fields like this:
<%= f.fields_for :rates do |g| %>
input type='hidden' id="business_rate_score" name="score"
input type='hidden' id="business_rate_dimension" name="dimension"
input type='hidden' id="business_rate_klass" name="klass"
<% end %>
For making nested_attributes in Review model:
letsrate_rateable "speed"
accepts_nested_attributes_for :rates, :allow_destroy => true
It throws No association found for name `rates'. Has it been defined yet? (ArgumentError)
Is letsrate gem accepting nested attributes? Can you explain me to make nested attributes to save the values?
The text was updated successfully, but these errors were encountered: