он появляется на рабочем сервере, а на локальном сервере он не отображается, проблема в Subscribe_Controller, там я определяю, какие параметры отправляются MailChimp для списка рассылки, вот журнал ошибок от $heroku run rails console
.Rails - in `private ': nil не является символом l (TypeError)
/app/app/controllers/subscribe_controller.rb:11:in `private': nil is not a symbo
l (TypeError)
from /app/app/controllers/subscribe_controller.rb:11:in `<class:Subscrib
eController>'
from /app/app/controllers/subscribe_controller.rb:1:in `<top (required)>
'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:274:in `block in require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:240:in `load_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:360:in `require_or_load'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:317:in `depend_on'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:233:in `require_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/engin
e.rb:472:in `block (2 levels) in eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/engin
e.rb:471:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/engin
e.rb:471:in `block in eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/engin
e.rb:469:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/engin
e.rb:469:in `eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/engin
e.rb:346:in `eager_load!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/appli
cation/finisher.rb:56:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/appli
cation/finisher.rb:56:in `block in <module:Finisher>'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:30:in `run'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:55:in `block in run_initializers'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tso
rt_each'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 lev
els) in each_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:210:in `block (2 lev
els) in each_strongly_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:210:in `block (2 lev
els) in each_strongly_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:210:in `block (2 lev
els) in each_strongly_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongl
y_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:209:in `block in eac
h_strongly_connected_component_from'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:44:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:44:in `tsort_each_child'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:203:in `each_strongl
y_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:209:in `block in eac
h_strongly_connected_component_from'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:44:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:44:in `tsort_each_child'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:203:in `each_strongl
y_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:209:in `block in eac
h_strongly_connected_component_from'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:44:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:44:in `tsort_each_child'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:203:in `each_strongl
y_connected_component_from'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in eac
h_strongly_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongl
y_connected_component'
from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/initi
alizable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/appli
cation.rb:352:in `initialize!'
from /app/config/environment.rb:5:in `<top (required)>'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:274:in `block in require'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:240:in `load_dependency'
from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.7.1/lib/active
_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/appli
cation.rb:328:in `require_environment!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/comma
nds/commands_tasks.rb:142:in `require_application_and_environment!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/comma
nds/commands_tasks.rb:67:in `console'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/comma
nds/commands_tasks.rb:39:in `run_command!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.7.1/lib/rails/comma
nds.rb:17:in `<top (required)>'
from /app/bin/rails:4:in `require'
from /app/bin/rails:4:in `<main>'
здесь журнал с сервера производства:
2016-09-21T14:53:45.788249+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www.ifurniture.pe request_id=4e9cd392-23bb-4160-8f2b-e9886cf25016 fwd="190.234.106.227" dyno= connect= service= status=503 bytes=
это файл Subscribe_Controller.rb ..
class SubscribeController < ApplicationController
def create
logger.info "suscripcion #{params.inspect}"
user = user_params(params)
MailchimpWrapper.subscribe(user, params[:group_name], params[:group])
redirect_to '/gracias'
rescue Mailchimp::Error => e
logger.error "ERROR mailchimp #{e.message} #{params.inspect}"
end
private def user_params(params)
user = {
email: params[:email].try(:downcase),
first_name: params[:first_name].try(:titleize),
last_name: params[:last_name].try(:titleize),
city: params[:city].try(:titleize),
phone: params[:phone],
comment: params[:comment].try(:titleize)
}
user
end
end
Я определить метод в новой линии, как это. .
private
def user_params(params)
user = {
email: params[:email].try(:downcase),
first_name: params[:first_name].try(:titleize),
last_name: params[:last_name].try(:titleize),
city: params[:city].try(:titleize),
phone: params[:phone],
comment: params[:comment].try(:titleize)
}
user
end
end
и получить эта ошибка в производственном сервере ...
2016-09-21T15:28:29.628087+00:00 app[web.1]: Started POST "/suscribir" for 190.234.106.227 at 2016-09-21 15:28:29 +0000
2016-09-21T15:28:29.635751+00:00 app[web.1]: Processing by SubscribeController#create as HTML
2016-09-21T15:28:29.635762+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"5sO+oVCDUD949rHpZz4RSxnSqpfXGZ9p9XwF+NO6HOkYPpfB95v1Wrn6EgxR7N+rEpVHOHuRtEaBAhNmoWTYVA==", "group_name"=>"suscriptores", "group"=>"newsletter", "email"=>"[email protected]", "commit"=>"SUSCRIBIRSE"}
2016-09-21T15:28:29.635763+00:00 app[web.1]: suscripcion {"utf8"=>"✓", "authenticity_token"=>"5sO+oVCDUD949rHpZz4RSxnSqpfXGZ9p9XwF+NO6HOkYPpfB95v1Wrn6EgxR7N+rEpVHOHuRtEaBAhNmoWTYVA==", "group_name"=>"suscriptores", "group"=>"newsletter", "email"=>"[email protected]", "commit"=>"SUSCRIBIRSE", "controller"=>"subscribe", "action"=>"create"}
2016-09-21T15:28:29.638002+00:00 app[web.1]: ERROR mailchimp You must provide a MailChimp API key {"utf8"=>"✓", "authenticity_token"=>"5sO+oVCDUD949rHpZz4RSxnSqpfXGZ9p9XwF+NO6HOkYPpfB95v1Wrn6EgxR7N+rEpVHOHuRtEaBAhNmoWTYVA==", "group_name"=>"suscriptores", "group"=>"newsletter", "email"=>"[email protected]", "commit"=>"SUSCRIBIRSE", "controller"=>"subscribe", "action"=>"create"}
2016-09-21T15:28:29.657213+00:00 app[web.1]: [1m[35mRefinery::Page Load (0.8ms)[0m SELECT "refinery_pages".* FROM "refinery_pages" WHERE "refinery_pages"."menu_match" = $1 ORDER BY "refinery_pages"."id" ASC LIMIT 1 [["menu_match", "^/404$"]]
2016-09-21T15:28:29.661415+00:00 app[web.1]: [1m[36mRefinery::PagePart Load (2.1ms)[0m [1mSELECT "refinery_page_parts".* FROM "refinery_page_parts" WHERE "refinery_page_parts"."refinery_page_id" IN (2) ORDER BY position ASC[0m
Буду внимательно относиться к вашим ответам.
Наблюдая за тем, что ... – iFurniture
Привет, я поставил код, как вы указали, и теперь у меня есть эта ошибка. 'ActionView :: Template :: Error (Нет маршрутов) {: action =>" create ",: controller =>" subscribe "}):' на локальном сервере работает, но на рабочем сервере не работает – iFurniture
Я бы необходимо увидеть обновленный код, чтобы правильно понять эту ошибку. Поскольку это не связано с вашим первоначальным вопросом (который теперь разрешен), пожалуйста, [отправьте его как новый вопрос] (http://stackoverflow.com/questions/ask). –