From e6057681de8c6bac096788ca5be677464df2dc80 Mon Sep 17 00:00:00 2001 From: dave98 Date: Wed, 13 Jul 2022 17:25:55 -0500 Subject: [PATCH] Feat: Added properties controller --- Gemfile | 3 ++ Gemfile.lock | 3 ++ app/controllers/properties_controller.rb | 64 ++++++++++++++++++++++++ app/controllers/sessions_controller.rb | 7 ++- app/controllers/users_controller.rb | 4 +- app/models/property.rb | 2 +- app/models/user.rb | 2 + config/initializers/cors.rb | 15 ++++++ config/routes.rb | 10 +++- db/seeds.rb | 3 +- 10 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 app/controllers/properties_controller.rb create mode 100644 config/initializers/cors.rb diff --git a/Gemfile b/Gemfile index 1c7700e..3b34e4a 100644 --- a/Gemfile +++ b/Gemfile @@ -51,6 +51,9 @@ gem "bootsnap", require: false # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] # gem "image_processing", "~> 1.2" +# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible +gem "rack-cors" + group :development, :test do # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem gem "debug", platforms: %i[ mri mingw x64_mingw ] diff --git a/Gemfile.lock b/Gemfile.lock index 8dee3eb..9865dc2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -137,6 +137,8 @@ GEM nio4r (~> 2.0) racc (1.6.0) rack (2.2.4) + rack-cors (1.1.1) + rack (>= 2.0.0) rack-test (2.0.2) rack (>= 1.3) rails (7.0.3) @@ -212,6 +214,7 @@ DEPENDENCIES jbuilder pg (~> 1.1) puma (~> 5.0) + rack-cors rails (~> 7.0.2, >= 7.0.2.4) sprockets-rails stimulus-rails diff --git a/app/controllers/properties_controller.rb b/app/controllers/properties_controller.rb new file mode 100644 index 0000000..8912da2 --- /dev/null +++ b/app/controllers/properties_controller.rb @@ -0,0 +1,64 @@ +class PropertiesController