Displaying 2 results from an estimated 2 matches for "new_price".
2006 Aug 19
5
Form helpers don''t work with facade columns?
...;'ve been trying to use a facade column but I notice that the form
helpers don''t seem to respect the facade.
In the following example I''m trying to story the prices as Integer
values but present them to the user as decimals.
class Product < ActiveRecord::Base
def price=(new_price)
write_attribute(:price, Float(new_price)*100)
end
def price
read_attribute(:price)/100.00
end
end
and for the most part that works great, I can call product.price and get
9.99, I call product.price=9.99 and it gets stored in the DB as 999.
However, when I use the form helpers in...
2006 Apr 14
2
Nested AJAX remote_form in form?
...n'', :cols => 100, :rows => 4 %>
<div id="categories">
<%= form_remote_tag :update => ''categories'',
:url => { :action => ''add_category'' } %>
<%= text_field_tag ''new_price'' %>
<%= submit_tag ''Add'' %>
</div>
<%= submit_tag "Create" %>
<% end_form_tag %>
But I know for sure that this isn''t going to work due to the nested use
of forms. Is there a Rails-way to submit using AJAX wh...