Skip to content

Commit

Permalink
CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
krissy committed Apr 10, 2016
1 parent d82d69f commit d9f265b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ gem 'kaminari', '~> 0.16.3'
# User Puma as the app server
gem 'puma'

gem 'rack-cors', '~> 0.3.1'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ GEM
pg (0.18.4)
puma (3.4.0)
rack (1.6.4)
rack-cors (0.3.1)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.6)
Expand Down Expand Up @@ -236,6 +237,7 @@ DEPENDENCIES
paperclip (~> 4.3)
pg
puma
rack-cors (~> 0.3.1)
rails (= 4.2.6)
rails_12factor
rspec-rails
Expand Down
8 changes: 8 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ class Application < Rails::Application

# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true

config.middleware.insert_before 0, "Rack::Cors" do
allow do
origins '*'
resource '*', :headers => :any, :methods => [:get]
end
end

end
end
1 change: 0 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree

add_foreign_key "drawings", "locations"
add_foreign_key "drawings", "users"
end

0 comments on commit d9f265b

Please sign in to comment.