我在Active Admin中遇到两个大问题
当我去编辑用户时,加密密码没有显示,所以基本上我不得不破解我自己的网站并将另一个加密密码复制并粘贴到该字段中以更新用户 - 这与创建用户相同
第二个问题是我无法创建新用户。当我去创建用户时没有任何反应。我没有收到错误。页面只刷新,用户不保存。
User.rb
ActiveAdmin.register User do
controller do
def permitted_params
params.permit!
end
end
end
我尝试销毁我的活动管理员安装,然后重新安装它并再次生成模型,但结果相同。我正在使用Rails 4.2.1和Ruby 2.0.0。
gem 'activeadmin', github: 'activeadmin'
在development.rb
中Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
我尝试将config.cache_classes = false更改为true,但这也不起作用。
我不知道该怎么做。有什么建议?我认为这是一个错误。希望它可以修复。感谢。
答案 0 :(得分:1)
您的app/admin/user.rb
文件中的allowed_params方法似乎是非常规的,可能会导致您遇到问题。您需要像这样添加它们,如果您想要更改/编辑它,还需要输入:encrypted_password ...
ActiveAdmin.register User do
permit_params :email, :password, :password_confirmation, :encrypted_password
...
end