Set a default value with simple_form

hello
anyone know how i can set a default integer value with simple_form, i
have code like this below in my view but its not working.

<%= f.input :age, :value => ‘30’ %>

i would like the input box to have the value of 30 by default
thanks for any help.

Hello Brent,

On Sat, Jan 7, 2012 at 1:17 PM, brent brent [email protected]
wrote:

hello
anyone know how i can set a default integer value with simple_form, i
have code like this below in my view but its not working.

<%= f.input :age, :value => ‘30’ %>

i would like the input box to have the value of 30 by default
thanks for any help.

If I understand your intent, it has nothing to do with simple_form.
Either a migration-based default value for the database field or a
model-based, after_create filter could be used to set the initial
value of the age field in a newly-created instance of the object.
That, in turn, will have the result that it appears to me you’re
trying to achieve.

HTH,
Bill

<%= f.input :name, :input_html => { :value => ‘test’} %>

Ahmy Y.