-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scopes in list view not work with RA 0.6.6 #2143
Comments
I think your custom scope(probably class method?) might be returning nil. |
class Product < ActiveRecord::Base
acts_as_tenant(:tenant)
scope :p , -> {where("securekey is not null")}
scope :s , -> {where("securekey is null")}
rails_admin do
object_label_method do
:to_label
end
list do
scopes [:p, :s, nil]
field :price
field :parent
end
end
end |
This is weird. In Rails console, Loading development environment (Rails 4.2.0)
2.1.5 :001 > Product.all.send(:p)
=> nil
2.1.5 :002 > Product.all.p
D, [2014-12-30T11:24:02.619010 #32919] DEBUG -- : Product Load (2.1ms) SELECT "products".* FROM "products" WHERE (securekey is not null)
=> #<ActiveRecord::Relation []>
2.1.5 :003 > Product.all.send(:p)
D, [2014-12-30T11:24:05.381362 #32919] DEBUG -- : Product Load (0.2ms) SELECT "products".* FROM "products" WHERE (securekey is not null)
=> #<ActiveRecord::Relation []> As you can see, first For now, you can use a scope name other than |
thx :) |
Any news on this one? Mine doesn't work either with v0.6.5. The scopes array is simply ignored and the tabs just don't show up. I'm using Ruby 2.1.5 and Rails 4.1.8. |
undefined method `each' for nil:NilClass
Showing /Users/xxxx/MyHomeCloud/Dev/MyApp/app/views/rails_admin/main/index.html.haml where line 128 raised:
The text was updated successfully, but these errors were encountered: