Rails_Admin是否支持JSON?

时间:2013-08-15 22:47:12

标签: json ruby-on-rails-4 rails-admin

运行'rails_admin'的安装程序时:

rails g rails_admin:install

我收到以下错误:

Unsupported field datatype: json (RuntimeError)

我正在使用Rails 4应用程序,它有几个不同的模型。其中一个具有JSON属性(注意:具有JSON属性的模型不是我现有的'用户'模型)。

这仅仅是因为rails_admin不能很好地使用Rails 4吗?或者我在做什么不正确的事情?

3 个答案:

答案 0 :(得分:2)

是的! - 2014年2月增加了对json字段类型的支持:

https://github.com/sferik/rails_admin/pull/1757

https://github.com/sferik/rails_admin/issues/1715

答案 1 :(得分:1)

此时看起来有一个拉动请求处于不确定状态。所以现在,没有。

要解决此问题,您可以尝试跳过使用json字段的任何模型。

编辑您的config / initializers / rails_admin.rb文件,如下所示:

(假设我在名为Authorization and Tweet的模型中有json字段)

RailsAdmin.config do |config|
  ... # could have some other stuff here
  # Exclude specific models (keep the others):
  config.excluded_models = ['Authorization', 'Tweet']
  ... # could have some other stuff here
end

然后运行或重新运行

rails g rails_admin:install

它应该成功,然后告诉你迁移。

答案 2 :(得分:0)

考虑到rails_admin不支持postgres数组,现在我得到了json字段类型的相同错误,我会不会这样做。

相关问题