Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is select tag in rails form not working?
    text
    copied!<p>I have a user registration form:</p> <pre><code>&lt;%= form_for(resource, :as =&gt; resource_name, :url =&gt; registration_path(resource_name), :id =&gt; "employer-form") do |f| %&gt; &lt;%= devise_error_messages! %&gt; &lt;p&gt;&lt;%= f.email_field :email, :autofocus =&gt; true, :title =&gt; "Enter email", :value =&gt;"Enter Email", :class =&gt;"field" %&gt;&lt;/p&gt; &lt;p&gt;&lt;%= f.text_field :profile_name, :autofocus =&gt; true, :title =&gt; "Enter Username", :value =&gt; "Enter Username", :class =&gt;"field" %&gt;&lt;/p&gt; &lt;p class="clearfix"&gt; &lt;%= f.password_field :password, :title =&gt; "Enter Password", :value =&gt; "Enter Password", :class =&gt; "field field-half" %&gt; &lt;%= f.password_field :password_confirmation, :title =&gt; "Retype Password", :value =&gt; "Retype Password", :class =&gt; "field field-half" %&gt; &lt;/p&gt; &lt;p class="clearfix"&gt; &lt;%= f.text_field :first_name, :title =&gt; "Enter First Name", :value =&gt; "Enter First Name", :class =&gt; "field field-half" %&gt; &lt;%= f.text_field :last_name, :title =&gt; "Retype Last Name", :value =&gt; "Enter Last Name", :class =&gt; "field field-half" %&gt; &lt;/p&gt; &lt;p class="clearfix"&gt; &lt;div class="custom-select"&gt; &lt;%= f.select_tag(:how_did_you_hear, options_for_select ([["Bing", :bing],["College Rep", :college_rep], ["Facebook", :facebook],["Google", :google], ["Pinterest", :pinterest],["Yahoo", :yahoo], ["Twitter", :twitter],["Other", :other]])) %&gt; &lt;/div&gt; &lt;/p&gt; &lt;div&gt;&lt;%= f.submit "Sign up" %&gt;&lt;/div&gt; &lt;% end %&gt; </code></pre> <p>The select tag works if I take away the "f." right before it. But if I take that away, it won't go to the user object. If I put the "f." in, it says: </p> <pre><code>undefined method `select_tag' for #&lt;ActionView::Helpers::FormBuilder:0x007f950db434e0&gt; </code></pre> <p>I've seen some stackoverflow questions that are similar but don't help. The documentation mentions this briefly but it is too complicated for a newbie like myself to understand.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload