当我在开发模式下运行Rails服务器时,它将运行。但是,如果我尝试运行RAILS_ENV = production rails服务器,则显示一些错误,我无法解决。 这是我的错误日志:-
=> Booting Puma
=> Rails 5.2.0 application starting in production
=> Run `rails server -h` for more startup options
Exiting
/home/sharat/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:355:in `check_conditionals': Passing string to be evaluated in :if and :unless conditional options is not supported. Pass a symbol for an instance method, or a lambda, proc or block, instead. (ArgumentError)
from /home/sharat/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:301:in `initialize'
from /home/sharat/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:289:in `new'
from /home/sharat/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:289:in `build'
from /home/sharat/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:672:in `block in set_callback'
from /home/sharat/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:671:in `map'
from /home/sharat/.rvm/gems/ruby-2.4.3/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:671:in `set_callback'
from /home/sharat/.rvm/gems/ruby-2.4.3/gems/activemodel-5.2.0/lib/active_model/callbacks.rb:131:in `block in _define_before_model_callback'
我的应用程序控制器外观
class ApplicationController < ActionController::Base
self.responder = ApplicationResponder
respond_to :html
before_action :configure_permitted_parameters, if: :devise_controller?
rescue_from ActiveRecord::RecordNotFound do
flash[:warning] = 'Resource not found.'
redirect_back_or root_path
end
rescue_from CanCan::AccessDenied do |exception|
redirect_to role_based_path, :alert => exception.message
end
def redirect_back_or(path)
redirect_to request.referer || path
end
def after_sign_in_path_for(resource)
role_based_path
end
protect_from_forgery with: :exception
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
devise_parameter_sanitizer.permit(:account_update, keys: [:username, :role])
end
end