rails-admin

Rails_admin: How to delete nested objects in rails 4?

人走茶凉 提交于 2019-12-24 13:10:35
问题 I am having: class Entity < AR::Base has_many :representatives, inverse_of: :entity, dependent: :destroy accepts_nested_attributes_for :representatives, allow_destroy: true end and the Entity's rails admin form allows me to create nested representatives inline. Though, I am unable to remove representatives through the entity's nested form after they are already saved. I am suspicious that this is related with rails 4 since there are other similar questions with answers that do not work: Rails

Custom model in rails_admin

旧城冷巷雨未停 提交于 2019-12-24 11:29:43
问题 I have such problem: I'm using rails_admin and gem acts_as_taggable_on. Second have model ActsAsTaggableOn::Tag. And I need to manage it in admin part. Google and StackOverflow don't know answer, or I forgot, how to google =( So, what I tried: Added that in initializers/rails_admin.rb config.model ActsAsTaggableOn::Tag do label 'Тэг' label_plural 'Тэги' configure :name, :string end Still no reaction. But if I try to add config.included_models = [ActsAsTaggableOn::Tag] Then I see that model in

Rails 3.2 Engines - routes not working in test cases

我的未来我决定 提交于 2019-12-24 06:00:57
问题 I mounted in my app the RailsAdmin engine ( according to the instructions from the wiki ) using mount RailsAdmin::Engine => '/backend', :as => 'rails_admin' I had to extend one controller from the engine to add a before_filter. When running my app in development, my extension and the other engine features are working perfectly. However I have an issue in writing functional tests using Test::Unit for my before_filter. The filter kicks in at the right moment and works as expected, but once the

Manage soft deleted records(paranoia) in rails_admin

邮差的信 提交于 2019-12-24 05:42:55
问题 In my rails 4 app I'm using paranoia to soft delete users and rails_admin for admin interface. Currently in rails_admin after deleting a record it doesn't show deleted records. I want to see all records in rails_admin where deleted records are marked differently and create a custom action to restore deleted records. Thanks! 回答1: You now have deleted scope on your model. Add this to rails_admin config to view your deleted records: list do scopes [nil, 'deleted'] 来源: https://stackoverflow.com

rails_admin Change belongs_to Drop-down to Display Options from Different Field

点点圈 提交于 2019-12-24 02:07:39
问题 I am using rails_admin 0.6.5 with Rails 4.1.6 and have a has_many / belongs_to association setup between the Volume and Issue models respectively: class Volume < ActiveRecord::Base has_many :issues, :inverse_of => :volume validates :number, presence: true, numericality: {greater_than_or_equal_to: 1} end and the Issue model: class Issue < ActiveRecord::Base belongs_to :volume, :inverse_of => :issues validates :number, presence: true, numericality: {greater_than_or_equal_to: 1} validates :date,

rails_admin dashboard/secondary_navigation customization

瘦欲@ 提交于 2019-12-23 16:27:34
问题 Any chance to customize dashboard or secondary navigation? Yes i can create app/view/rails_admin/main/dashboard.html.haml and redesign whole page from scratch. But what should I do if I want just add simple partial before and safe current content? In case with secondary navigation I tried to replace _secondary_navigation.html.haml in all places where partials could be - nothing happens. 回答1: app/views/layouts/rails_admin/_secondary_navigation.html.haml Here is the place were it should live.

Why is my rails route is a bit off?

别来无恙 提交于 2019-12-23 15:18:07
问题 I have my root route root :to => 'home#index' which is for my home controller and if i visit http://localhost:3000/ all works great i hit the proper home controller and index action. I then installed this gem rails_admin But when i visit http://localhost:3000/admin i hit the method in my application controller rescue_from CanCan::AccessDenied do |exception| redirect_to root_path, :alert => exception.message end and get this error, how is it possible that now i have a routing error...any idea

Scopes as filters in rails_admin

↘锁芯ラ 提交于 2019-12-22 04:15:11
问题 I am using rails_admin in my app. I have some scopes on my models, following is an example: class User < ActiveRecord::Base scope :unconfirmed, where('confirmed_at IS NULL') end Is it possible in rails_admin to get access to those scope as a filter? Like you can in active admin. Like adding a button somewhere on in the users section. Thanks 回答1: I've managed to do this successfully by adding a custom rails_admin action. More details: https://github.com/sferik/rails_admin/wiki/Custom-action

Rails_admin and pundit: undefined method `policy' for #<RailsAdmin::MainController

蓝咒 提交于 2019-12-21 17:44:39
问题 I'm on rails 5 and I'm trying to implement authorizations with pundit for my rails_admin panel. So I included pundit in my application controller and installed the rails_admin_pundit gem as you can see in this snippet of my Gemfile: gem 'devise' gem 'devise-i18n' gem 'rails_admin', '~> 1.0' gem 'rails_admin-i18n' gem 'rails_admin_tag_list', github: 'kryzhovnik/rails_admin_tag_list' gem 'pundit' gem "rails_admin_pundit", :github => "sudosu/rails_admin_pundit" The application policy: class

Rails Admin - removing a related object

旧城冷巷雨未停 提交于 2019-12-20 01:44:32
问题 I'm using Rails Admin on one of my sites. It's great so far, but I can't figure out how to remove a related object from an edit page. Example: I have two models Property and PropertyImage. class Property has_many :property_images, :dependent => :destroy end class PropertyImage belongs_to :property end I can go to the edit screen for an instance of either model, and I can delete PropertyImages from their list view. But when I edit a Property, I want to be able to delete a PropertyImage that's