Witam. Mam problem z helper in_place_editor_field.
Otóż działa on bez problemu w przypadku kiedy do widoku wysylam pojedyńczy egzemplarz obiektu. Ale w momęcie kiedy wysylam kolekcje, nie mogę wywołać na poszczegółnym elemencie in_place_editor_field.
Np.
<% @tasks.each do |t| %>
<%= in_place_editor_field 't', 'name' %>
<% end %>
dostaje wtedy error:
Called id for nil, which would mistakenly be 4 – if you really wanted the id of nil, use object_id
<% @tasks.each do |t| %>
<%= in_place_editor_field 't', 'name' %>
<% end %>
in_place_editor_field jako pierwszy parametr przyjmuje obiekt. W Twoim kodzie zamiast obiektu jest string?
Co prawda pomogło, ale jest inny problem.
Mam pole amountbrutto, które jest typu float. Po wyslaniu zapytania in_place_edit (i ustawienia automatycznej metody obslugujacej to zapytanie w kontrolerze) napotkal mnie taki error (z loga)
NoMethodError (undefined method `size’ for 587.0:Float):
<% @transfers.each do |t|
@transfer = t
@transfer.amountbrutto = t.amountbrutto.to_s
%>
...
<td><%= in_place_editor_field :transfer, :amountbrutto %></td>
...
To samo Może nie w tym miejscu “to_s”?