forms - rails select field custom attribute -


i have scaffold default new, edit, create, etc. methods.

my new method looks like:

 def new    @group = params[:id]    @people = person.all 

now want create method "select" like

def select     render action: 'select' end 

and select.html.erb should contain 1 select box select group, need input new method.

how (form?) have like.

first of all

def select     render action: 'select' end 

for sure won't , cause infinite loop error, because render :action=>your_action renders action of controller, , here render action itself.

to interact views, need method

respont_to |format| format.html end 

as understood, need use radio button. api:

<%= radio_button_tag(:age, "child") %> <%= label_tag(:age_child, "i younger 21") %> <%= radio_button_tag(:age, "adult") %> <%= label_tag(:age_adult, "i'm on 21") %> 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -