activeadmin

How do you handle serialized edit fields in an Active Admin resource?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 03:59:22
问题 I have a model, Domain , which has a text field, names . > rails g model Domain names:text invoke active_record create db/migrate/20111117233221_create_domains.rb create app/models/domain.rb > rake db:migrate == CreateDomains: migrating ================================================== -- create_table(:domains) -> 0.0015s == CreateDomains: migrated (0.0066s) ========================================= I set this field as serialized into an array in the model. # app/models/domain.rb class

How do I edit or override the footer of ActiveAdmin?

故事扮演 提交于 2019-12-21 03:59:06
问题 How do I edit or override the footer of Active_Admin? 回答1: Answer: In your rails app, create this file: app/admin/footer.rb The content would be something like: module ActiveAdmin module Views class Footer < Component def build super :id => "footer" super :style => "text-align: right;" div do small "Cool footer #{Date.today.year}" end end end end end Don't forget! restart the app/server. Any ActiveAdmin layout component can be customized like this. More about it: Why does it work? This is

ActiveAdmin - Using scopes with filters

家住魔仙堡 提交于 2019-12-20 23:24:07
问题 In my ActiveAdmin model I have a custom scope to show deleted records and several filters for searching records by specific columns. Using the filters individually or combined together works as expected. Using a scope works as expected. The problem is that using a scope seemingly overrides all the filters and after selecting a scope any filter added does nothing. Anyone have any ideas here? What I want is to be able to show a specific scope and then still be able to filter results within that

Active Admin: sorting on multiple columns

醉酒当歌 提交于 2019-12-20 15:30:15
问题 Active Admin doesn't seem to support multiple columns sorting yet (i.e. pass multiple values to the config.sortable option). I saw an old monkey patch here but it doesn't seem to work with my version (1.0.0.pre from Github). Is there any way to get multiple sortable columns on the latest Active Admin version? 回答1: This is also a monkey patch: Create a new file in config/initializers or in the lib folder: multiple_columns_sorting.rb module ActiveAdmin class ResourceController < BaseController

Active Admin: sorting on multiple columns

梦想的初衷 提交于 2019-12-20 15:27:13
问题 Active Admin doesn't seem to support multiple columns sorting yet (i.e. pass multiple values to the config.sortable option). I saw an old monkey patch here but it doesn't seem to work with my version (1.0.0.pre from Github). Is there any way to get multiple sortable columns on the latest Active Admin version? 回答1: This is also a monkey patch: Create a new file in config/initializers or in the lib folder: multiple_columns_sorting.rb module ActiveAdmin class ResourceController < BaseController

ActiveAdmin nested form on #show page

半城伤御伤魂 提交于 2019-12-20 14:42:14
问题 Is it possible to add nested form to #show page? Now i have my admin/posts.rb: ActiveAdmin.register Post do show do |post| h2 post.title post.comments.each do |comment| row :comment do comment.text end end end end It lists all the comments for post. Now i need a form to add new comments. I'm trying to do like this: ActiveAdmin.register Post do show do |post| h2 post.title post.comments.each do |comment| row :comment do comment.text end end form do |f| f.has_many :comments do |c| c.input :text

ActiveAdmin ForbiddenAttributesError

拈花ヽ惹草 提交于 2019-12-20 12:04:00
问题 i am a brand new for Ruby on Rails. I am using a ActiveAdmin and i have a problem with creating a AdminUser ActiveModel::ForbiddenAttributesError in Admin::AdminUsersController#create ActiveModel::ForbiddenAttributesError Request Parameters: {"utf8"=>"✓", "authenticity_token"=>"nvV++6GNTdA/nDzw1iJ6Ii84pZPcv2mzg0PK2Cg9Ag0=", "admin_user"=>{"email"=>"admin2@example.com"}, "commit"=>"Create Admin user"}* Rails 4.1.0 activeadmin 1.0.0 ruby 2.1 app/admin/admin_user.rb ActiveAdmin.register

Create dynamic forms in ActiveAdmin

别等时光非礼了梦想. 提交于 2019-12-20 10:57:45
问题 Hi guys I'm pretty stuck with building a customised form in active admin. I've figured out and even set up my own customised forms using active admin. However I need to create a dynamic form here. This involves making some ajax calls and returning partials of a form for the user to fill out. It seems that you can create a member action but that is on resources that have been created. In my case I need to create multiple entries on a resource that is yet to be created. 回答1: This might get you

Ruby/Rails - Remove ActiveAdmin from my application

ⅰ亾dé卋堺 提交于 2019-12-20 09:50:51
问题 I had a good time playing with Active Admin the administrative framework within my application. http://activeadmin.info/ When I installed it I ran rails g active_admin:install rake db:migrate rails g active_admin:resource product and it generated alot of migrations and code within my application. My question if I would like to go back and have everything that active_admin put into my application taken out, how would i do so? Is there one 'rails active_admin:uninstall' command to get rid of

ActiveAdmin: how to leave user password unchanged?

血红的双手。 提交于 2019-12-20 09:29:53
问题 I uses ActiveAdmin as my administration backend in my rails app. Basically, I have a admin_user and a user model. When I create a new user from an admin account, I specify an email and a password, that is ok. Let's say I then want to modify the user's email but not the password... it seems this cannot be done as the password field cannot be blank when updating a user. Is there a configuration somewhere that would consider that the password is unchanged is the fields (password and password