rails-admin

Multi file upload with rails_admin (Carrierwave, Paperclip, Dragonfly)

北城以北 提交于 2019-12-06 20:40:29
I'm looking for a quick solution for multi file upload with rails_admin. Any ideas or solutions out there? The approach I'd take here is to develop a custom action which would include it's own view and controller processing. You can generate a rails_admin plugin with the directions at the top of the page here . And here are some examples of custom actions I've built out: Import Print to PDF The import plugin has a supporting blog article here . This is the file you want to look at where you add your upload behavior inside the :controller instance option. 来源: https://stackoverflow.com/questions

ActiveRecord::HasManyThroughNestedAssociationsAreReadonly Error in Rails Admin

好久不见. 提交于 2019-12-06 05:34:57
问题 I just upgraded to Rails 3.2.10 and am getting an error message that I never used to get when updating a record via RailsAdmin. ActiveRecord::HasManyThroughNestedAssociationsAreReadonly at /admin/vendor/12/edit Message Cannot modify association 'Vendor#categories' because it goes through more than one other association. This is my Vendor model: class Vendor < ActiveRecord::Base attr_accessible :name, :description, :banner_image, :logo_image, :intro_text, :thumb_image, :category_ids, :product

Rails Admin vs Active Admin : Rails Admin generation tools [duplicate]

。_饼干妹妹 提交于 2019-12-06 02:50:07
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Rails Admin vs. ActiveAdmin I'm aware that there is already another question about this, but it was not so useful to me. I'm looking for an Admin generation tool for Rails and, apart from personal taste, I ca'nt decide whether use Rails Admin, Active Admin or other tools. HAve you had any experience with them? Can you suggest which you prefer, giving tech explanaitions and feedbacks? 回答1: I haven't tried Rails

Authenticate using Devise and Rails Admin for particular routes

旧街凉风 提交于 2019-12-06 02:25:53
问题 I use Rails Admin and Devise for admin and user model. I have added one column "admin" to the user model to indicate its identity. In the config/routes.rb , I mount /admin for RailsAdmin:Engine I want to only allow current_user.admin users to access /admin , otherwise, redirect user to home page. How can I implement this in the cleanest code? 回答1: on your admin controllers: class MyAdminController < ApplicationController before_filter :authenticate_user! before_filter :require_admin end on

Rails_admin: Should I have admin_user or user with admin role to manage users and admin panel

馋奶兔 提交于 2019-12-06 02:10:43
问题 In my rails application website visitors can sign up and create content. It uses devise with user model and everything works well. Now I want to use rails_admin for managing website resources and users etc and only people with administrative previllages should be able to access it. Should I create a separate AdminUser model for admin panel access or use User model with role of admin, and use some authorization library to manage access. If I user only one model then I want users to be

Rails Admin Customization: embed html view into dashboard

自作多情 提交于 2019-12-05 18:42:23
We have removed the dashboard and the history from the rails admin starting page: Now we want to embed a google analytics page for users to see the dashboards from GA. This page consists of some simple HTML. QUESTION: How do you embed html pages in the Rails Admin Dashboard. Vinozio The answer was very simple, I needed to create the following file: views/rails_admin/main/dashboard.html.erb And this overwrites the standard dashboard, easy as that. Found the information here I can provide a partial answer to your question which is a complete answer to your question. The answer to your question

Source Reflection Errors with has_many :through

我的梦境 提交于 2019-12-05 13:20:24
I'm attempting to create a system where my site's users can favorites pages. Those pages have two types, either clubs or sports. So, I have four models, associated as such: User Model: class User < ActiveRecord::Base .. has_many :favorites has_many :sports, :through => :favorites has_many :clubs, :through => :favorites .. end Favorites Model: class Favorite < ActiveRecord::Base .. belongs_to :user belongs_to :favoritable, :polymorphic => true end Club Model: class Club < ActiveRecord::Base .. has_many :favorites, :as => :favoritable has_many :users, :through => :favorites def to_param slug end

Routing Error for a model with a join_table and has_many :through in RailsAdmin

独自空忆成欢 提交于 2019-12-05 10:33:21
So I have 3 models: category , product , category_products . This is my category.rb attr_accessible :name has_many :category_products do def with_products includes(:product) end end has_many :products, :through => :category_products This is my product.rb attr_accessible :name, :description, :price, :vendor_id, :image, :category_ids belongs_to :vendor has_many :category_products do def with_categories includes(:category) end end has_many :categories, :through => :category_products This is my category_product.rb attr_accessible :product_id, :category_id, :purchases_count belongs_to :product

Scopes as filters in rails_admin

帅比萌擦擦* 提交于 2019-12-05 05:01:13
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 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 For example: # in lib/rails_admin/unconfirmed.rb require 'rails_admin/config/actions' require 'rails_admin

ActiveRecord::HasManyThroughNestedAssociationsAreReadonly Error in Rails Admin

两盒软妹~` 提交于 2019-12-04 11:37:00
I just upgraded to Rails 3.2.10 and am getting an error message that I never used to get when updating a record via RailsAdmin. ActiveRecord::HasManyThroughNestedAssociationsAreReadonly at /admin/vendor/12/edit Message Cannot modify association 'Vendor#categories' because it goes through more than one other association. This is my Vendor model: class Vendor < ActiveRecord::Base attr_accessible :name, :description, :banner_image, :logo_image, :intro_text, :thumb_image, :category_ids, :product_ids, :user_id, :remove_banner_image, :banner_image_cache, :remove_logo_image, :logo_image_cache mount