19 lines
470 B
Ruby
19 lines
470 B
Ruby
class MessagesController < ApplicationController
|
|
skip_before_action :verify_authenticity_token
|
|
|
|
|
|
def create
|
|
if params[:title].length > 300 || params[:name].length > 50 || params[:description].length > 1000
|
|
render json: {}, status: 400
|
|
else
|
|
@message = Message.create(message_params)
|
|
render json: {}, status: :created
|
|
end
|
|
end
|
|
|
|
private
|
|
def message_params
|
|
params.permit(:title, :phone, :description, :email, :name)
|
|
end
|
|
end
|