Search code examples
ruby-on-railsformtastic

formtastic select, one entry selected as default


I have an input which I render :as => :select. I would like one option to be selected as default. How would I go about that?

Thanks, Hendrik


Solution

  • So set a preselected answer you have to associate your object with the desired value.

    countries = ['USA','Germany']
    @user.country = countries.first
    

    That works for me.