activeadmin


Active Admin Scope with rails 4.1


I am getting this error in Active Admin with rails 4.1
Showing ../bundler/gems/active_admin-ad33a0f6c772/app/views/active_admin/resource/index.html.arb where line #1 raised:
undefined method `call' for ClassList::ActiveRecord_Relation:0xa9f44bc
Extracted source (around line #1)
1 insert_tag renderer_for(:index)
Below is my code that I am using
ActiveAdmin.register ClassList do
#....
scope :upcoming_classes
#....
end
and in Model
class ClassList < ActiveRecord::Base
scope :upcoming_classes, where('class_date > ?', Date.today)
end
Please anyone help me in fixing this error?
Thanks,
You should define your scope using a proc.
class ClassList < ActiveRecord::Base
scope :upcoming_classes, proc { where('class_date > ?', Date.today) }
end
Rails 4+ expects scopes to be wrapped with a callable object, which is usually defined as a proc. See the Active Record Query Interface: Scopes documentation; there they use the -> { } proc syntax.

Related Links

activeadmin custom filter that contains 2 words on the same attribute
why is activeadmin confusing normal user with admin user?
ActiveAdmin - how to find the id of the default scope?
Changing activeadmin use of model name to another method in forms and show pages
ActiveAdmin Customized Filter Using Params and Scopes
How to remove default links on navigation bar and change their order
Rails 4 cocoon gem not working with js
Numbering items in an ActiveAdmin Report
cocoon link_to_add_association adds empty association fields rails 4 erb
How would I split a form into multiple pages?
Activeadmin custom filter and scope for custom index records Rails 4
ActiveAdmin 'show' layout not same as edit / new
ActiveAdmin - has_many and arbitrary html with the newer (1.0.0) dsl
Rails 4 activeadmin - undefined local variable or method `view_factory' for :Arbre::Context
undefined method `query_parameters' in Active Admin show/panel/table_for
ActiveAdmin: Child object claims to not have method parent_object_id

Categories

HOME
python-2.7
oracle
memory
macos-sierra
xcode
apple-push-notifications
yaml
yii
kendo-dropdown
scroll
transactions
loopbackjs
android-emulator
mirc
clone
position
tweepy
reportviewer
colors
buffer
live-streaming
outlook-restapi
varnish-vcl
angular2-highcharts
social-tables
sqlplus
kaggle
gollum-wiki
pymongo
fluent-migrator
substring
opentext
ipa
fatfs
memory-fences
actframework
apptentive
buildforge
nsuserdefaults
grails3.2.0
classnotfoundexception
julius-speech
transparency
asihttprequest
ipp-protocol
common-table-expression
axis
nonlinear-functions
renderman
simple-schema
asp.net-web-api-routing
apache-modules
swiperefreshlayout
deviare
metabase
bigdecimal
s-function
openquery
pyaudio
nvda
zynq
conan
fdt
gwt-syncproxy
gravatar
cortana
json-spirit
godeps
libz
explain
kefir.js
dbmigrate
debug-symbols
thoughtworks-go
encryption-symmetric
vs-unit-testing-framework
rubber
nesper
rails-api
pageviews
windows-taskbar
san
sql-view
quickgraph
mongo-jackson-mapper
significant-digits
linkbutton
audiotoolbox
clearinterval
dropshadow
microblogging
asio
bass
resharper-5.1
odac
stretchblt

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App