Created
January 12, 2010 02:18
-
-
Save mvr/274810 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@number = Number.find_or_create_by_value(:value => params[:value]) | |
if not @number.valid? | |
@fact = Fact.new(params[:fact]) | |
@intended_value = @number.value | |
render 'facts/new' and return | |
end | |
@fact = @number.facts.new(params[:fact]) | |
if @fact.save | |
session[:votes] << @fact.id | |
redirect_to number_path(@number) | |
else | |
render 'facts/new' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment