Closed CrisSoFresh closed 10 years ago
I am getting the same error... and I although I have added the acts-as but it still cannot resolve the problem
@BattleBrisket comment on #59 is complete
I had the same issue on the newest master branch (activeadmin/activeadmin/commit/930d34cd224272687613dcf1db4cf5b1347f1098) of active_admin. The thing that caused it, was custom 'filter' options which were not wrapped in proc objects.
Filter part can be changed like this to avoid getting this kind of errors.
ActiveAdmin.register Table do
begin filter: id filter: name rescue p "msg" end
end
I was also getting same error on rake db:migrate. I just commented that line and rake db:migrate runs perfectly and comment it after
Got the same error.
helped moving in models form scope :foo -> {bar}
to def self.foo bar;end
for table loading for avoid error
Replace ActiveAdmin.routes(self)
with below line in routes.rb
ActiveAdmin.routes(self) rescue ActiveAdmin::DatabaseHitDuringLoad
This fixes the issue.
@r-a-o It works for me also. Thanks
I find proc{}
is work for me.
I ended up converting the scope
to a class method as suggested in https://github.com/hzamani/acts_as_relation/issues/71#issuecomment-207807292, but only after trying to figure out what using a proc
means for custom filters. @estelleqiu and @zpieslak are you referring to setting the collection
option as in the following (see docs):
filter :author, collection: proc { Author.all }
rescue ActiveAdmin::DatabaseHitDuringLoad
It worked for me too!
Hi, I've a Rail 4 project with ActiveAdmin and emerged a little problem with migrations. This project have a typical AdminUser model but this time with a Receptionist inherit from AdminUser, so my
acts_as
method looks likeacts_as :admin_user
. This works fine in runtime but when runrake db:drop
,rake db:create',
rake db:migrate`, etc I get some circular reference problem as I see in other previous issues (calling the AdminUser table), but this time I get a standard ActiveAdmin error :Searching a little I found this : https://github.com/gregbell/active_admin/blob/master/lib/active_admin/error.rb
Then to try to solve (provisionally) the problem, I use this :
acts_as :admin_user if connection.table_exists? 'admin_users'
in my Receptionist class.This works fine, but clearly it is a very dirty solution. Have any ideas to improve it or make it more elegant? (thinking that you can probably add more models inheriting from AdminUser).
Thanks in advance