我是新來的在生產模式下配置Rails應用程序。我的Rails應用程序工作正常,但是當我嘗試在生產模式下運行它,它啓動時崩潰:在生產模式下運行Rails應用程序時出錯
rails s
=> Booting WEBrick
=> Rails 4.0.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
這裏一切都很好,而且:
RAILS_ENV=production rails c
/Users/dawid/.rvm/gems/[email protected]/gems/activesupport-4.0.1/lib/active_support/dependencies.rb:229:in `require': /Users/dawid/workspace/demioorg/Dineria/backend/app/controllers/users/users_controller.rb:6: syntax error, unexpected ':', expecting keyword_end (SyntaxError)
render_status: 200,
我只是想知道爲什麼在開發模式下工作而不是在生產模式下工作?什麼會導致該錯誤?
編輯:
class Users::UsersController < Devise::SessionsController
respond_to :json
def is_user
if current_user.present?
render_status: 200,
json: {
success: !User.find_by_name(params[:name]).blank?
}
end
end
end
你可以顯示你的users_controller嗎? – dax
我用users_controller編輯了我的問題。但我不知道爲什麼它只能在開發模式下正常工作 – Dawid
如果你嘗試: render:json => {success:...},:status => 200 ? – Niall