首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rails 4活动管理问题

Rails 4活动管理问题
EN

Stack Overflow用户
提问于 2016-01-03 00:13:56
回答 1查看 540关注 0票数 1

我的Active Admin有两个大问题

当我去编辑一个用户时,加密的密码不会显示出来,所以基本上我必须破解我自己的网站,并将另一个加密的密码复制并粘贴到字段中以更新用户-这与创建用户是一样的。

第二个问题是我不能创建新用户。当我去创建一个用户时,什么也没有发生。我没有得到一个错误。页面只会刷新,用户不会保存。

User.rb

代码语言:javascript
复制
ActiveAdmin.register User do

controller do
    def permitted_params
      params.permit! 
    end
  end

end

我试着销毁我安装的active admin,然后我重新安装它,并再次生成模型,但结果相同。我使用的是Rails 4.2.1和Ruby 2.0.0。

代码语言:javascript
复制
gem 'activeadmin', github: 'activeadmin'

在development.rb中

代码语言:javascript
复制
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,但也不起作用。

我不知道在这里该做什么。有什么建议吗?我想这是个bug。希望它能被修复。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2016-01-03 00:56:08

您的app/admin/user.rb文件中的permitted_params方法似乎是非常规的,可能会给您带来问题。你需要像这样添加它们,如果你想要更改/编辑它,还需要把它们放入:encrypted_password中……

代码语言:javascript
复制
ActiveAdmin.register User do
  permit_params :email, :password, :password_confirmation, :encrypted_password
  ...
end
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34567898

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档