Пытаюсь сделать обратный звонок но что то не выходит:
Ruby 2.3.3
Rails 4.2
mongoid 5.2.1
haml
Gemfile
source 'https://rubygems.org'
ruby '2.3.3'
# core
gem 'rails', '4.2.0'
gem 'sass-rails'
gem 'sprockets'
gem 'compass-rails'
gem 'mongoid'
gem 'delayed_job_mongoid'
gem 'newrelic_rpm'
gem 'devise'
gem 'responders'
gem 'puma'
# front end & layouts
# gem 'bootstrap', '~> 4.0.0.alpha5'
# gem 'tether-rails'
gem 'bootstrap-sass'
gem 'turbolinks'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'therubyracer'
gem 'money-rails'
gem "font-awesome-rails"
gem 'nested_form'
gem 'haml'
gem 'dropzonejs-rails'
# gem 'twitter-bootstrap-rails'
gem 'sanitize'
gem 'russian'
gem 'ckeditor', github: 'galetahub/ckeditor'
gem 'chosen-rails'
# gem 'galetahub-simple_captcha', require: 'simple_captcha'
gem 'simple_captcha', :git => 'git://github.com/Azdaroth/simple-captcha.git', :branch => 'rails-4'
gem "letter_opener"
gem 'kaminari'
gem 'kaminari-i18n'
gem 'kaminari-mongoid'
gem 'bootstrap-kaminari-views'
gem 'toastr-rails'
# uploader
gem 'mini_magick'
gem 'unicode_utils'
gem 'carrierwave'
gem 'carrierwave-mongoid'
Модель:
callback.rb
class Callback
include Mongoid::Document
field :name, :type => String
field :email, :type => String
field :phone, :type => Integer
field :comment, :type => String
end
Контроллер:
callbacks_controller.rb
class CallbacksController < ApplicationController
def new
@callback = Callback.new
end
def create
@callback = Callback.new(callback_params)
if @callback.save
redirect_to (session[:return_to] || :back), notice: 'Спасибо за заявку! Наши менеджеры скоро свяжутся с вами.'
else
render action: 'new'
end
end
private
def callback_params
params.require(:callback).permit(:name, :email, :phone, :comment)
end
end
routes.rb
get '/callback' => 'callbacks#new', as: :custom_callbaks
post '/callback' => 'callbacks#create', as: :custom_callbaks_create
Вьюха
_header.html.haml
.callback
%a.call{:href => "#openModal"} Заказать звонок
#openModal.modal
.modal-dialog
.modal-content
.modal-header
%h3.modal-title Заказать звонок
%a.close{:href => "#close", :title => "Close"} ×
.modal-body
= form_for :callback, url: custom_callbaks_path do |f|
.wrap-call
.col-call
= f.label 'Ваше имя*'
= f.text_field :name, required: true
.col-call
= f.label 'E-mail'
= f.text_field :email
.col-call
= f.label 'Телефон *'
= f.text_field :phone, required: true
.col-call
= f.label 'Комментарий', for: :comment
= f.text_area :comment, id: 'comment'
.col-call
= f.submit 'Оформить заявку'
Все это выдает вот такую ошибку:
ArgumentError at /callback
wrong number of arguments (given 1, expected 5)
Скрин:
http://i.prntscr.com/3riiXKqLShukWfzeAJbi6A.png
Скрин консоли:
http://i.prntscr.com/JI2u2KfES92a8ogj_yo65Q.png