Permalink
Browse files

quotes#create

  • Loading branch information...
1 parent 6c60a8d commit 1c8f21c11feed320c97dff2b63d6d48175cfc80e @bavardage committed Aug 21, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 app/controllers/quotes_controller.rb
@@ -20,4 +20,24 @@ def new
@wall = Wall.find(params[:wall_id])
@quote = Quote.new
end
+
+ def create
+ @wall = Wall.find(params[:wall_id])
+ @quote = Quote.new params[:quote]
+
+ @quote.author = current_user
+ @quote.wall = @wall
+
+ #TODO: should also here extract tagged users!
+
+ respond_to do |format|
+ if @quote.save
+ format.html { redirect_to wall_path(@wall) }
+ format.json { render :json => quote }
+ else
+ format.html { render :action => :new }
+ format.json { @obj = wall; render "layouts/errors.json" }
+ end
+ end
+ end
end

0 comments on commit 1c8f21c

Please sign in to comment.