Skip to content

Instantly share code, notes, and snippets.

@bmax
Created February 14, 2014 02:53
Show Gist options
  • Save bmax/8995008 to your computer and use it in GitHub Desktop.
Save bmax/8995008 to your computer and use it in GitHub Desktop.
1 class OffersController < ApplicationController
2 before_action :authorize_user
3 def show
4 @validOffer = Offer.exists?(params[:id]);
5 puts @validOffer
6 if @validOffer
7 @offers = Offer.where(:question_id => params[:question_id]);
8 else
9 redirect_to root_path
10 end
11
12 end
13 def new
14 @offer = Offer.new
15 @offer.question_id = params[:question_id]
16 end
17 end
16 resources :questions do
17 resources :offers
18 end
1 <h1>Sign Up</h1>
2
3 <%= simple_form_for @offer do |f| %>
4 <%= f.label :bid %>
5 <%= f.input :bid %>
6 <%= f.label :note %>
7 <%= f.input :note %>
8 <%= f.label :time_estimate%>
9 <%= f.input :time_estimate%>
10 <%= f.button :submit, "Create bid!" %>
11 <% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment