Tag: activeadmin

ActiveAdmin资产预编译错误

ActiveAdmin给了我一个 Undefined mixin ‘global-reset’. 尝试运行时出错 rake assets:precompile ActiveAdmin是0.3.4。 我的Gemfile中有ActiveAdmin和资产组,包括sass,coffee-rails和uglifier。

如何将Devise和ActiveAdmin用于相同的用户模型?

我有ActiveAdmin和Devise与用户合作。 我想使用Devise登录具有相同用户模型的常规非管理员用户。 我怎样才能做到这一点? (我想在User模型中只为管理员设置一个admin标志。)我尝试将第二行添加到routes.rb devise_for :users, ActiveAdmin::Devise.config devise_for :users 但是当我试图列出路线时,它给出了一个错误 >rake routes DL is deprecated, please use Fiddle rake aborted! ArgumentError: Invalid route name, already in use: ‘new_user_session’ You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with […]

ActiveAdmin:如何覆盖索引控制器操作:nil的未定义方法`base’:NilClass

我正在尝试覆盖ActiveAdmin控制器的索引操作,以显示current_user的结果而不是所有结果。 controller do def index @user_tasks = UserTask.where(:user_id => current_user.id).page(params[:page]) end end 访问ActiveAdmin时,抛出exception: ActionView::Template::Error (undefined method `base’ for nil:NilClass): 1: render renderer_for(:index) 我正在使用rails 3.1和最新的ActiveAdmin版本。 gem “activeadmin”, :git => ‘https://github.com/gregbell/active_admin.git’ 。

Activeadmin阻止我的jQuery工作

我正在使用jquery拖放我的应用程序,它工作正常。 然后我添加了activeadmin,它停止了我的jquery工作。 我收到这个错误 $(“.draggable_article_image”).draggable is not a function 如果我从active_admin.js中删除此行 //= require active_admin/base 它又开始工作了。 有任何想法吗?

如何编辑或覆盖ActiveAdmin的页脚?

如何编辑或覆盖Active_Admin的页脚?

ActiveAdmin自动加载完整关联表

我正在开发一个使用ActiveAdmin作为其管理后端的项目。 我有两个型号,一个有很多产品的书籍型号。 当我尝试在ActiveAdmin中访问产品索引视图时,它似乎尝试将完整的书籍表加载到内存中(我的数据库中有大约150万本书)。 CPU使用率高达100%,内存使用率达到千兆字节。 打开mysql日志记录确认这是调用此视图时发生的情况: 17 Query SELECT `books`.* FROM `books` 据我所知,在任何加载产品的尝试之前都会发生这种情况。 为了弄清楚这个问题,我把模型剥离到他们的骨头: class Product < ActiveRecord::Base belongs_to :book end class Book < ActiveRecord::Base has_many :products end 我还将AA定义缩减为最基本的forms: ActiveAdmin.register Product do end 这对ActiveAdmin来说是正常的吗? 这似乎不是理想的行为。

Active Admin中的嵌套表单

我需要帮助! 我有2个模型用于调查: class Poll :destroy accepts_nested_attributes_for :poll_questions, :reject_if => lambda { |a| a[:text].blank? }, :allow_destroy => true end 问题的模型如下:(似乎这些关联是正确的) class PollQuestion :destroy accepts_nested_attributes_for :poll_answers, :reject_if => lambda { |a| a[:text].blank? }, :allow_destroy => true end 另外在活动管理员中: ActiveAdmin.register Poll do form do |f| f.inputs “Main poll” do f.input :title f.input :description end f.inputs do f.has_many :poll_questions […]

ActiveAdmin:批量选择所有页面

使用activeadmin,是否可以对特定模型的所有记录执行批处理操作,而不是在当前页面上选择的那些记录?

动态调整Active Admin表单上的下拉字段(rails 3.2)

我在Ruby on Rails应用程序上有一个非常基本的架构: 公司模式 行业模式(属于行业的公司) 子行业模式(子行业属于行业) 在我的活动管理表单页面上,我想放置字段,以便对于每个公司,我首先选择它所属的行业的下拉(这到目前为止工作),然后选择另一个字段“子行业”,它只会显示根据我在之前的领域中选择的行业,我在此行业中已经分类过的子行业。 例如,古柯将进入行业“饮料和饮料”,我希望动态调整forms,只显示在“sub indsutry”领域:“热饮”,“冷饮”,“茶”的下拉菜单,“苏打水” form do |f| f.inputs “Company” do f.input :company_industry_id, :label => “Select industry:”, :as => :select, :collection => CompanyIndustry.all f.input :company_subindfustry_id, :label => “Select subindustry:”, :as => :select, :collection => CompanySubindustry.all end 显然我到目前为止遇到了一个问题,它向我展示了我所拥有的所有子行业,而不仅仅是我在前一个领域选择的行业中的子行业。 有谁知道我怎么解决这个问题?

无法构建嵌套的多态关联’。 您是否正在尝试构建多态一对一关联

我有一个类似的情况,我有活动,其中有一个任务有一个任务,建立任务也将构建任务,如下所示: def new @activity = Activity.new @activity.task = @activity.build_task end 现在我的条款有许多TermTranslations有许多附件有一个可附加(图像或音频)但行18 @term = Term.new(permitted_params[:term])的admin / term.rb我收到此错误: 无法建立协会“可附加”。 您是否正在尝试构建多态一对一关联。 管理员/ term.rb ActiveAdmin.register Term do permit_params :id, :display_name, :slug, term_translations_attributes: [:id, :slug, :title, :definition, :example, :language_id, :term_id, :_destroy, attachments_attributes: [:id, :name, :attachable_type, :attachable_id, :_destroy, attachable_attributes: [:id, :image_file, :audio_file, :_destroy]]] form partial: ‘form’ controller do def new @term […]