Skip to content

Instantly share code, notes, and snippets.

@beaugaines
Created April 15, 2015 13:51
Show Gist options
  • Save beaugaines/c1475d728c0cafc14d4c to your computer and use it in GitHub Desktop.
Save beaugaines/c1475d728c0cafc14d4c to your computer and use it in GitHub Desktop.
incoming_controller.rb
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