ruby on rails 4 - Format Value with Delimiter in Nested Form -


I am using Ryan Bats nested_form mani () and my 'edit' form.

I am currently using this on my 'United Nations-nested' farm field and it works great! But when I formatted one of the nested elements in the same way, code ' undefined method error '

code for working on 'un-Nested Fields' The code gets

  value: number_with_delimiter (f.object.reserve_price, exact: 2)  

Nested form field on edit

  & lt; Div id = "product" & gt; & Lt;% = f.fields_for: Products ,: Cover = & gt; Make false Product_form | & Gt%; & Lt; Div class = "form-group" & gt; & Lt; Div class = "input-group col-md-4" & gt; & Lt; Div class = "input-group-connector" & gt; $ & Lt; / Div & gt; & Lt;% = product_form.text_field: retail_weekly_price, category: "form-control", placeholder: 'Retail Weekly Rate Card', Required: Truth, (Add Value Call Results in Error ***)% & gt; & Lt; Div class = "input-group-addon" & gt; .00 & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt;% end% & gt; & Lt; / Div & gt;  

Added error log

  ActionView :: Template :: error (# & lt; Undefined method for location ` Retail_weekly_pris') Location: 0x007fd46baa35b0 & gt;): 160: & lt; Div class = "form-group" & gt; 161: & lt; Div class = "input-group call-MD-4" & gt; 162: & lt; Div class = "input-group-addon" & gt; $ & Lt; / Div & gt; 163: & lt;% = product_form.text_field: retail_weekly_price, category: "form-control", placeholder: 'Retail Weekly Rate Card', Required: true, value: number_file (f.object.retail_weekly_price, precision: 2)% & Gt; 164: & lt; Div class = "input-group-addon" & gt; .00 & lt; / Div & gt; 165: & lt; / Div & gt; 166: & lt; / Div & gt; App / View / Location / _edit_form.html. ARB: 163: _app_views_locations__edit_form_html_erb__1967616523010840695_70275187628360 'App / view / location / _edit_form.html in block (2 level). ARP: 137: in _app_views_locations_edit_form_html_erb__1967616523010840695_70275187628360 'app / view / locations / _edit_form.html. ARB: 1: in `_app_views_locations__edit_form_html_erb__1967616523010840695_70275187628360 'app / view / location / edit.html.  
  

Value: number_to_currency (product_form.object.retail_weekly_price, exact: 2)

instead of

  value: number_with_currency (f.object.retail_weekly_price, Precision: 2)  

As the retail_wikely_prix field is in the Products table.

location you are referring to nested_form_for and retail_weekly_price Field locations is not present in the table, you get an error

product_form.object product will be mentioned in the . Fields_for . You will not have any problem accessing it through the Retail_Weekly_prix field.

In addition, ActionView Supporting method name number_travel accumulation and not number_with_currency


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -