Created
April 15, 2015 13:51
-
-
Save beaugaines/c1475d728c0cafc14d4c to your computer and use it in GitHub Desktop.
incoming_controller.rb
This file contains hidden or 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
class IncomingController < ApplicationController | |
skip_before_action :verify_authenticity_token, only: [:create] | |
def create | |
@user = User.find_by(email: params[:sender]) | |
if @user.nil? | |
head 500 | |
end | |
@bookmark = @user.bookmarks.build(url: params['body-plain']) | |
@bookmark.tag_list.add(params[:subject]) | |
if @bookmark.save | |
head 200 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment