Ruby on rails Rails:Fedena网页出现重定向循环错误。无方法错误未定义nil:NilClass的方法配置值
我已经在我的网站上安装了fedena(rails应用程序) 我已经安装了所有插件,gems,创建并迁移了数据库 我创建了这样的符号链接Ruby on rails Rails:Fedena网页出现重定向循环错误。无方法错误未定义nil:NilClass的方法配置值,ruby-on-rails,Ruby On Rails,我已经在我的网站上安装了fedena(rails应用程序) 我已经安装了所有插件,gems,创建并迁移了数据库 我创建了这样的符号链接 ln -s ~/fedena/public ~/public_html 当访问我的网页时,它会显示 此网页有一个重定向循环 所以请帮帮我。我是个新手,我试过安装这个 最后一次申请 一个月。我想我已经走到了最后一步。所以请帮我 解决这个错误。我将非常感谢你 我的生产日志文件是 # Logfile created on Fri Jul 26 14:55:03 +
ln -s ~/fedena/public ~/public_html
当访问我的网页时,它会显示
此网页有一个重定向循环
所以请帮帮我。我是个新手,我试过安装这个
最后一次申请
一个月。我想我已经走到了最后一步。所以请帮我
解决这个错误。我将非常感谢你
我的生产日志文件是
# Logfile created on Fri Jul 26 14:55:03 +0530 2013
Processing UserController#login (for 182.73.241.18 at 2013-07-26 15:00:48) [GET]
Parameters: {"action"=>"login", "controller"=>"user"}
[FedenaRescue] No method error undefined method `config_value' for nil:NilClass
NoMethodError (undefined method `config_value' for nil:NilClass):
app/controllers/application_controller.rb:319:in `set_user_language'
vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `send'
vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in `evaluate_method'
vendor/bundle/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:225:in `call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:629:in `run_before_filters'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:615:in `call_filters'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/flash.rb:146:in `perform_action'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `send'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `process_without_filters'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in `process'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in `call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in `call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:87:in `dispatch'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:121:in `_call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
vendor/bundle/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call'
vendor/bundle/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in `call'
vendor/bundle/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
vendor/bundle/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in `cache'
vendor/bundle/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in `call'
vendor/bundle/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/string_coercion.rb:25:in `call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in `call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in `call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call'
vendor/bundle/ruby/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:106:in `call'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:180:in `start'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server:99
Redirected to http://technoadmin.com/user/dashboard
这些是从310到325的行,我的应用程序_controller.rb中只有325行
return @local_tzone_time
end
private
def set_user_language
lan = Configuration.find_by_config_key("Locale")
I18n.default_locale = :en
Translator.fallback(true)
if session[:language].nil?
I18n.locale = lan.config_value
else
I18n.locale = session[:language]
end
News.new.reload_news_bar
end
end
问题在于名为
config\u value
NoMethodError (undefined method config_value' for nil:NilClass): app/controllers/application_controller.rb:319:inset_user_language'
因此,请在第319行检查您的应用程序\u controller.rb
,并发布其中的内容
编辑:
在您的代码(第319行)中,您正在调用lan
上的config\u value
——但错误消息是lan
有一个nil值,因此无法对其调用config\u值
前面有
lan=Configuration.find\u by\u config\u key(“Locale”)
——所以我猜rails找不到名为“Locale”的配置键——但我真的不确定。这段代码是你写的还是由gem生成的?我在使用Docker在Ubuntu20.04上安装Fedena时遇到了同样的问题
每次我尝试在上访问浏览器上的应用程序时http://server-address:8080:/user/dashboard,我得到了一个重定向。然后在我的控制台上,我得到一个错误:
web_1 | Processing UserController#dashboard (for 103.89.5.96 at 2020-10-25 18:33:15) [GET]
web_1 | Parameters: {"controller"=>"user", "action"=>"dashboard"}
web_1 | [FedenaRescue] No method error undefined method `config_value' for nil:NilClass
web_1 |
web_1 | NoMethodError (undefined method `config_value' for nil:NilClass):
web_1 | app/controllers/application_controller.rb:342:in `set_user_language'
以下是我如何修复它的方法:
注意:这是一个临时修复,因为我没有太多时间深入研究代码库
问题源于app/controllers/application.rb
文件中的此代码:
private
def set_user_language
lan = Configuration.find_by_config_key('Locale')
I18n.default_locale = :en
Translator.fallback(true)
I18n.locale = if session[:language].nil?
lan.config_value
else
session[:language]
end
News.new.reload_news_bar
end
# before_filter :set_user_language
我假设操作set\u user\u language
尝试根据在用户的计算机/应用程序上设置的默认区域设置语言或会话语言为用户设置语言,但是lan.config\u value
中调用Ian
的config\u value
方法似乎是Nil
这会导致重定向错误,因为它是在app/controllers/application.rb中使用before\u过滤器调用的:
before_filter :set_user_language
因此,在应用程序中完成任何操作之前都会调用它
临时修复方法是在app/controllers/application.rb
文件顶部定义的过滤器之前注释掉:
private
def set_user_language
lan = Configuration.find_by_config_key('Locale')
I18n.default_locale = :en
Translator.fallback(true)
I18n.locale = if session[:language].nil?
lan.config_value
else
session[:language]
end
News.new.reload_news_bar
end
# before_filter :set_user_language
现在您可以再次尝试访问该页面
<>您可以考虑运行命令<代码> RAKDB:种子>代码>,将包含在dB/StEn.Rb 文件中的数据存入数据库,因为它包含了一些需要应用程序才能顺利运行的重要数据。而且它似乎还包含config\u值用于配置的数据
就这些
我希望这有帮助请修复格式化i18n.locale=lan.config\u值查看我上面链接的格式化页面,并在主帖子中发布应用程序控制器的第310-330行。我已在主帖子中发布了代码。请帮助我解决由gem生成的错误。实际上,这是一个名为fedena(一个学校erp)的应用程序,我尝试在Site5上安装了它。你能猜出错误是什么吗?我该如何解决它?请