rails-admin

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

拜拜、爱过 提交于 2019-12-04 06:56:50
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? I haven't tried Rails Admin, but Active Admin is pretty nice. Active Admin is flexible in the sense that it lets you customize the admin panel at great length, but requires a little bit of

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

主宰稳场 提交于 2019-12-04 06:21:33
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 redirected to admin panel after signin if user is admin and if not then I want user to be redirected to their

Authenticate using Devise and Rails Admin for particular routes

空扰寡人 提交于 2019-12-04 06:08:21
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? rorra on your admin controllers: class MyAdminController < ApplicationController before_filter :authenticate_user! before_filter :require_admin end on your application controller: class ApplicationController < ActionController::Base def require_admin

Randomly showing NoMethodError: undefined method `empty?' for 0:Fixnum

无人久伴 提交于 2019-12-04 05:34:15
问题 It works fine on my local machine but gives following error in rails_admin on Heroku, using Puma web server. Here's how I'm using enumerize enumerize :date_type, in: { last_date: 0, begin_date: 1 }, default: :last_date, predicates: { prefix: true, only: :last_date }, i18n_scope: 'date_type' And it gives following error, I've pasted error from my rollbar. Refreshing the page a few times somehow works and it displays the model page just fine. But gives error most of the time. Also, using array

Using rails_admin with rails_api

╄→гoц情女王★ 提交于 2019-12-03 12:41:10
I originally posted this as an issue on rails_api GitHub , but am now posting it here due to inactivity. I'm trying to use rails_admin with a Rails 5 API application. I included extra ActionController modules up to the point that I can either have a functioning rails_admin panel or working API requests. The issue seems to be that rails_admin depends on ActionView::Layouts , which after included causes issues for API requests. Gemfile: gem 'rails', '>= 5.0.0.beta3', '< 5.1' ... gem 'rack-pjax', github: 'afcapel/rack-pjax' gem 'remotipart', github: 'mshibuya/remotipart' gem 'kaminari', github:

How to hide Add new option in Rails Admin

吃可爱长大的小学妹 提交于 2019-12-03 02:40:00
I am customizing Rails Admin : https://github.com/sferik/rails_admin , i need to disable/hide "Add new" option for some model. Any help will save lot time for me. Thanks in advance I use the following to achieve this on a specific model. Hopefully, this helps: config.actions do new do except ['Some Model'] end end The answer is in the configuration documentation for actions . By default, all actions are possible, including new . To customize the possible actions, in config.actions in config/initilizers/rails_admin.rb , list all the actions you want to support, leaving out the ones you don’t

Randomly showing NoMethodError: undefined method `empty?' for 0:Fixnum

给你一囗甜甜゛ 提交于 2019-12-02 11:08:06
It works fine on my local machine but gives following error in rails_admin on Heroku, using Puma web server. Here's how I'm using enumerize enumerize :date_type, in: { last_date: 0, begin_date: 1 }, default: :last_date, predicates: { prefix: true, only: :last_date }, i18n_scope: 'date_type' And it gives following error, I've pasted error from my rollbar. Refreshing the page a few times somehow works and it displays the model page just fine. But gives error most of the time. Also, using array instead of hash to define date_type, i.e. in: [:last_date, :begin_date] & not having date_type in list

Validates presense vs null false in Rails models/tables

梦想的初衷 提交于 2019-12-01 15:11:36
问题 I was playing around with Rails admin and I noticed something. Attributes which are defined as below in model, counted as "Required" in Rails admin validates :user, presence: true However, attributes which are defined as below in table (schema/migration) still counted as "Optional" t.datetime "created_at",:null => false I would have assumed that both of these are identical except perhaps the level from which the validation error pops up. Am I wrong or is this a Rails admin error? Are both of

rails_admin display name instead of id

让人想犯罪 __ 提交于 2019-11-30 11:24:19
问题 I've installed rails_admin into my app and I want to do something pretty basic...I have two models and their association comes up as expected...I have a seminar registration model that belongs_to :user. In the rails_admin it lists my seminar registration users as User #1, User #1, etc. I'd like to have that be the user's name instead. What I've managed to do is this: config.model SeminarRegistration do label "Seminar Signups" # Found associations: configure :user, :belongs_to_association

How do I show unscoped models in Rails Admin?

自闭症网瘾萝莉.ら 提交于 2019-11-29 07:22:39
I needed this myself, so here it is QA-style: By default, Rails Admin shows a model's default_scope. How do I get it to show every model completely unscoped? Approach 1 If you only need to list the records you can use the scopes method to control which records are returned. The first array element is the default, so if you add the following to your initialiser: list do scopes [:unscoped] end you will see all records. Approach 2 If you want to do more than list models you can create a dummy rails admin model. For example, assuming you have a Post model with a boolean archived flag: class Post <