Compare commits
No commits in common. "0797f9798d23be067531d790eb3e360bf42dc99a" and "01e10d49369edd7f243c8d2999a99c0eb804bab9" have entirely different histories.
0797f9798d
...
01e10d4936
2
Gemfile
2
Gemfile
|
@ -29,8 +29,6 @@ gem 'jbuilder', '~> 2.7'
|
||||||
gem 'bootsnap', '>= 1.4.2', require: false
|
gem 'bootsnap', '>= 1.4.2', require: false
|
||||||
gem 'rails_12factor', group: :production
|
gem 'rails_12factor', group: :production
|
||||||
|
|
||||||
gem 'rack-cors'
|
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
||||||
|
|
|
@ -155,8 +155,6 @@ GEM
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
racc (1.6.0)
|
racc (1.6.0)
|
||||||
rack (2.2.3)
|
rack (2.2.3)
|
||||||
rack-cors (1.1.1)
|
|
||||||
rack (>= 2.0.0)
|
|
||||||
rack-proxy (0.7.2)
|
rack-proxy (0.7.2)
|
||||||
rack
|
rack
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
|
@ -277,7 +275,6 @@ DEPENDENCIES
|
||||||
jbuilder (~> 2.7)
|
jbuilder (~> 2.7)
|
||||||
listen (~> 3.2)
|
listen (~> 3.2)
|
||||||
puma (~> 4.1)
|
puma (~> 4.1)
|
||||||
rack-cors
|
|
||||||
rails (~> 6.0.5)
|
rails (~> 6.0.5)
|
||||||
rails_12factor
|
rails_12factor
|
||||||
sass-rails (>= 6)
|
sass-rails (>= 6)
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
ActiveAdmin.register Message do
|
ActiveAdmin.register Message do
|
||||||
csv do
|
csv do
|
||||||
column :title
|
column :title
|
||||||
column(:name)
|
|
||||||
column(:email)
|
column(:email)
|
||||||
column(:phone)
|
column(:phone)
|
||||||
column(:description)
|
column(:description)# preserve case
|
||||||
# preserve case
|
|
||||||
end
|
end
|
||||||
# See permitted parameters documentation:
|
# See permitted parameters documentation:
|
||||||
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
|
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
|
||||||
#
|
#
|
||||||
# Uncomment all parameters which should be permitted for assignment
|
# Uncomment all parameters which should be permitted for assignment
|
||||||
#
|
#
|
||||||
permit_params :title, :name, :description, :email, :phone
|
permit_params :title, :description, :email, :phone
|
||||||
#
|
#
|
||||||
# or
|
# or
|
||||||
#
|
#
|
||||||
|
|
|
@ -4,11 +4,10 @@ class MessagesController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@message = Message.create(message_params)
|
@message = Message.create(message_params)
|
||||||
render json: {}, status: :created
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def message_params
|
def message_params
|
||||||
params.permit(:title, :phone, :description, :email, :name)
|
params.permit(:title, :phone, :description, :email)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
|
||||||
allow do
|
|
||||||
origins '*'
|
|
||||||
resource '*', :headers => :any, :methods => [:get, :post, :options]
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
class AddNameToMessage < ActiveRecord::Migration[6.0]
|
|
||||||
def change
|
|
||||||
add_column :messages, :name, :string
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in New Issue
Block a user