Created
April 3, 2015 17:37
-
-
Save bntzio/8b91ece1479e8dffffb5 to your computer and use it in GitHub Desktop.
icnoming controller
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
class IncomingController < ApplicationController | |
# http://stackoverflow.com/questions/1177863/how-do-i-ignore-the-authenticity-token-for-specific-actions-in-rails | |
skip_before_action :verify_authenticity_token, only: [:create] | |
def create | |
@user = current_user | |
@topic = Topic.create(title: params[:subject], user_id: @user.id) | |
@url = params["body-plain"] | |
@bookmark = Bookmark.create(url: @url, topic_id: @topic.id) | |
# @user = User.find_by(email: params[:sender]) | |
# @topic = Topic.find_by(title: params[:subject], user_id: @user_id) | |
# @url = "http://#{params["body-plain"]}" | |
# @user = User.create(email: params[:sender], password: "#{params[:title]}_bookmarkthis") if @user.nil? | |
# @topic = Topic.create(title: params[:subject], user_id: @user_id) if @topic.nil? | |
# @bookmark = Bookmark.create(url: @url, topic_id: @topic.id) | |
# puts "#{@user}, #{@topic}, #{@url}" | |
# Assuming all went well. | |
head 200 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment