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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hello Brent, On Sat, Jan 7, 2012 at 1:17 PM, brent brent <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
<%= f.input :name, :input_html => { :value => ''test''} %> Ahmy Yulrizka On Sun, Jan 8, 2012 at 2:31 AM, Bill Walton <bwalton.im-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello Brent, > > On Sat, Jan 7, 2012 at 1:17 PM, brent brent <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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 > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.