Skip to content

Instantly share code, notes, and snippets.

@scottmagdalein
Created July 6, 2012 23:57
Show Gist options
  • Save scottmagdalein/3063463 to your computer and use it in GitHub Desktop.
Save scottmagdalein/3063463 to your computer and use it in GitHub Desktop.
likes_controller#create
def create
@like = Like.new(params[:like])
@like = @applicant.likes.new(params[:likes])
@like.user_id = current_user.id
respond_to do |format|
if @like.save
format.html { redirect_to @like, notice: 'Like was successfully created.' }
format.json { render json: @like, status: :created, location: @like }
else
format.html { render action: "new" }
format.json { render json: @like.errors, status: :unprocessable_entity }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment