【发布时间】:2016-03-12 07:31:34
【问题描述】:
我最近开始在 Rails admin 中工作,当我尝试在 Rails admin 中编辑模型时出现此 500 错误。任何帮助表示赞赏。
config.model Order do
edit do
field :status do
label "Status"
end
end
end
TIA。
我的模特,
class Order < ActiveRecord::Base
belongs_to :customer, inverse_of: :orders
has_many :mmso
has_many :mmis, through: :mmso
has_one :hm, through: :mmi
has_one :pay
belongs_to :delivery, inverse_of: :orders
belongs_to :addr
错误日志以便进一步了解。
NoMethodError - undefined method `i18n_key' for nil:NilClass:
rails_admin (0.8.1) app/helpers/rails_admin/application_helper.rb:66:in `wording_for'
rails_admin (0.8.1) app/views/rails_admin/main/_form_nested_one.html.haml:7:in `__home_preethi__rbenv_versions_______lib_ruby_gems_______gems_rails_admin_______app_views_rails_admin_main__form_nested_one_html_haml___1061508105842580381_47125905871900'
actionview (4.2.4) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.4) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.4) lib/action_view/template.rb:143:in `render'
actionview (4.2.4) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial'
actionview (4.2.4) lib/action_view/renderer/partial_renderer.rb:310:in `block in render'
actionview (4.2.4) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.4) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.4) lib/action_view/renderer/partial_renderer.rb:309:in `render'
actionview (4.2.4) lib/action_view/renderer/renderer.rb:47:in `render_partial'
actionview (4.2.4) lib/action_view/renderer/renderer.rb:21:in `render'
actionview (4.2.4) lib/action_view/helpers/rendering_helper.rb:32:in `render'
haml (4.0.7) lib/haml/helpers/action_view_mods.rb:10:in `block in render_with_haml'
haml (4.0.7) lib/haml/helpers.rb:89:in `non_haml'
haml (4.0.7) lib/haml/helpers/action_view_mods.rb:10:in `render_with_haml'
rails_admin (0.8.1) lib/rails_admin/config/fields/base.rb:220:in `block in <class:Base>'
rails_admin (0.8.1) lib/rails_admin/config/configurable.rb:66:in `block in register_instance_option'
rails_admin (0.8.1) lib/rails_admin/config/proxyable/proxy.rb:27:in `method_missing'
spring (1.6.2) lib/spring/client.rb:28:in `run'
spring (1.6.2) bin/spring:49:in `<top (required)>'
spring (1.6.2) lib/spring/binstub.rb:11:in `<top (required)>'
/home/preethi/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
bin/spring:13:in `<top (required)>'
【问题讨论】:
-
你能分享错误回溯吗?
-
HI shivam,更新了问题。 :)
-
感谢您的帮助,状态字段中的标签引起了问题。修复它
标签: ruby ruby-on-rails-3 rails-admin