Displaying 2 results from an estimated 2 matches for "create_product".
Did you mean:
create_products
2006 Jan 28
0
Auto drop list: Create a form professional or easy?
...dynamically build a form. ( false/true field in
the DB should automatically be a droplist)
If you use "_form.rhtml" it works easy, with only this code in your partial,
but uses the extra file, and doesn''t feel profi and flexible.
<%= start_form_tag :action => ''create_product'' %>
<%= render :partial => ''form'' %>
<%= submit_tag ''Edit'' %>
<%= end_form_tag %>
If you do it like below, it looks really good and feels flexible, but that
won''t auto-create the droplists.
<%= start_form_tag :a...
2006 Jan 24
7
formatting numbers with commas
I needed to format numbers with commas to make it more human
readable. Here''s how I did it.
def commify(number)
c = { :value => "", :length => 0 }
r = number.to_s.reverse.split("").inject(c) do |t, e|
iv, il = t[:value], t[:length]
iv += '','' if il % 3 == 0 && il != 0
{ :value => iv + e, :length =>