activeadmin

Ruby On Rails Active Admin has_many changing text to use a different column

蓝咒 提交于 2019-12-25 05:20:53
问题 This is similar to my previous question Ruby On Rails Active Admin has_many changing dropdown to use a different column I figured out how to reassign a f.inputs but how would i go about reassigning the display of the data when viewing an item... e.g: Public Git Repo: https://github.com/gorelative/TestApp Snippet of code i have in my fillups.rb ActiveAdmin.register Fillup do form do |f| f.inputs do f.input :car, :collection => Car.all.map{ |car| [car.description, car.id] } f.input :comment f

Rails 4.2 ActiveAdmin get admins email addr

三世轮回 提交于 2019-12-25 03:54:38
问题 This query always returns [nil] AdminUser.all.collect{|a|a.email} However these two queries just work fine. AdminUser.all AdminUser.all.collect{|a| a.current_sign_in_ip} Why can't i get the email addresses? Update The email field itself is not nil .It is present in the AdminUser.all call and also this call retuns the correct email. >>au=AdminUser.find(1) >>au[:email] =>my@email.addr Solution to the original problem Through another question/problem i figured out i added attr_accessor on my

In ActiveAdmin Gem, how to add invitation count to Admin model?

时光总嘲笑我的痴心妄想 提交于 2019-12-25 02:19:02
问题 In my project I have implemented activeadmin gem, which is integrated with devise invitable. So in my application admin can invite a customer through an email. While inviting, i'm getting the following error: *ActiveRecord::StatementInvalid in Admin::CustomersController#send_invitation Mysql2::Error: Unknown column 'invitations_count' in 'field list': UPDATE `admin_users` SET `invitations_count` = COALESCE(`invitations_count`, 0) + 1 WHERE `admin_users`.`id` = 1* 回答1: This issue has happened

ActiveAdmin: Sort by association (belongs_to)

自作多情 提交于 2019-12-24 20:37:51
问题 I have an index admin view where I'm displaying an associated model City . I'd like to be able to sort by city name, but when I click the column header to sort I get the following error: ActiveRecord::StatementInvalid in Admin/deals#index SQLite3::SQLException: no such column: cities.name: SELECT "deals".* FROM "deals" ORDER BY cities.name desc LIMIT 30 OFFSET 0 Index view ActiveAdmin.register Deal do index do column :id column :city end ... end Model class Deal < ActiveRecord::Base belongs

Formtastic::UnknownInputError in ActiveAdmin::Devise::Sessions#new

偶尔善良 提交于 2019-12-24 17:28:04
问题 Using Rails 5.0.0.beta1. Installed Active Admin and Devise. Here is Gemfile contents: # Backend gem 'activeadmin', '~> 1.0.0.pre2' # Authentication # Master branch is added for Rails 5 support # https://github.com/plataformatec/devise/pull/3714 gem "devise", :github => 'plataformatec/devise', :branch => 'master' Followed instruction installation here. rails g active_admin:install User rake db:migrate rake db:seed rails server When I'm trying to enter /admin , the following error appears:

Add custom button to active admin form

孤街醉人 提交于 2019-12-24 14:08:18
问题 Is it at all possible to add a custom button along side the submit and cancel button that is generated with f.actions in this case The documents state form do |f| f.semantic_errors # shows errors on :base f.inputs # builds an input field for every attribute f.actions # adds the 'Submit' and 'Cancel' buttons link_to 'Preview', preview_my_admin_panel_posts_path(@post) end How could I add something here? Update So i have got my custom button to show now with this inputs 'Submit' do f.actions do

How to map id to name in active admin index?

我只是一个虾纸丫 提交于 2019-12-24 12:35:13
问题 I am using active admin. I have project and user model with many to many relationship between them. In my user model i have a project_leader boolean column. And in my project model i have project_leader as integer column. I am allowed to select 1 project leader for each project. And then id of the user who is the project leader is stored in Project project_leader column. How do i map the id of the user to its name from active admin index? 回答1: Solved: In my project model i defined a method as

Rails draw progress bar instead of integer value

懵懂的女人 提交于 2019-12-24 09:25:04
问题 I'm now using ActiveAdmin as the admin panel for Rails website. On index page of Teams, it shows team's score as integer. Instead of showing the integer, is there any way to show the static progress bar, scale of 100? Sorry for my poor english. Thanks for your help. 回答1: Just need to add static integer and it will dynamically show your progress bar. You need to customized a bit something like like this, also loop it <div class="progress"> <div class="progress-bar" role="progressbar" aria

I get ActiveModel::ForbiddenAttributesError with Active Admin and Devise

限于喜欢 提交于 2019-12-24 07:19:32
问题 I'm working on an app where I'm using Active Admin and Devise. I have modified both User and Admin Users table (via migration) to allow both models use one signing in process using Device instead of Active Admin. As 'super user' Admin can Sign In and access Admin Active. And application users wouldn't access Admin Active. The problem I'm face happens when I attempt to create a new user or Admin. I get the following error: ActiveModel::ForbiddenAttributesError in Admin::UsersController#create

How to use a find_by_sql query for an ActiveAdmin index page?

霸气de小男生 提交于 2019-12-24 03:39:10
问题 I'm using active admin on a project. I have a request to create a new resource and was given a complex SQL query to use - which connects to a different DB. All is good - however, I'm somewhat new to ActiveAdmin and curious how to get the index page to use my custom query vs. the default resource. I just need a nudge/sample to see how to override this default activity. 回答1: You can declare scopes and filters when registering your model with ActiveAdmin. app/model/your_model.rb class YourModel