Skip to content

Instantly share code, notes, and snippets.

@bmax
Created February 1, 2014 21:23
Show Gist options
  • Save bmax/8759125 to your computer and use it in GitHub Desktop.
Save bmax/8759125 to your computer and use it in GitHub Desktop.
question controller
def create
Question.create(params[:question]);
end
question new view
1 <h1>Question Form</h1>
2
3 <%= form_for @question, url: {action: "create"} do |f| %>
4
5 <div><%= f.label :title %></div>
6 <div><%= f.text_field :title %></div>
7
8 <div><%= f.label :subject %></div>
9
10 <div><%= f.collection_select(:subject, Subject.all, :id, :name) %></div>
11
12 <div><%= f.label :summary %></div>
13 <div><%= text_area(:question, :summary, cols: 60, rows: 20) %></div>
14
15 <div><%= f.submit "Submit Question" %></div>
16
17 <% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment