ryanb / cancan

Authorization Gem for Ruby on Rails.
MIT License
6.27k stars 783 forks source link

DataMapper: weird query for nested index action #698

Open siegfried opened 12 years ago

siegfried commented 12 years ago

I'm writing a DataMapper adapter to make DataMapper work on Parse. When I use #load_and_authorize_resource in nested resource controller, CanCan will generate a strange query for index action which I cannot implement. What does the condition ["0 = 1"] mean? It is just a string in an array. Is it a bug of CanCan or DataMapper? Thanks.

((["0 = 1"] AND merchant = #<Merchant @id="GvS6gZoyYk" @created_at=Tue, 24 Jul 2012 00:46:56 +0000 @updated_at=Tue, 24 Jul 2012 00:46:56 +0000 @category="Restaurant" @country=nil @fax=nil @description=nil @name=nil @pobox=nil @company=nil @phone=nil @state_or_city=nil @address=nil @website=nil @logo=#<URI::HTTP:0x007fcdd916e0c8 URL:http://files.parse.com/56610b3e-392c-4b41-b898-18cb3c8a58d4/xx.png>>) OR (merchant = #<Merchant @id="GvS6gZoyYk" @created_at=Tue, 24 Jul 2012 00:46:56 +0000 @updated_at=Tue, 24 Jul 2012 00:46:56 +0000 @category="Restaurant" @country=nil @fax=nil @description=nil @name=nil @pobox=nil @company=nil @phone=nil @state_or_city=nil @address=nil @website=nil @logo=#<URI::HTTP:0x007fcdd916e0c8 URL:http://files.parse.com/56610b3e-392c-4b41-b898-18cb3c8a58d4/xx.png>> AND merchant IN [#<Merchant @id="GvS6gZoyYk" @created_at=Tue, 24 Jul 2012 00:46:56 +0000 @updated_at=Tue, 24 Jul 2012 00:46:56 +0000 @category="Restaurant" @country=nil @fax=nil @description=nil @name=nil @pobox=nil @company=nil @phone=nil @state_or_city=nil @address=nil @website=nil @logo=#<URI::HTTP:0x007fcddc214858 URL:http://files.parse.com/56610b3e-392c-4b41-b898-18cb3c8a58d4/xx.png>>]))
siegfried commented 12 years ago

I find ["0 = 1"] is hard coded at here. Is there any story about it?

xhoy commented 10 years ago

Thanks for your submission! The ryanb/cancan repository has been inactive since Sep 06, 2013. Since only Ryan himself has commit permissions, the CanCan project is on a standstill.

CanCan has many open issues, including missing support for Rails 4. To keep CanCan alive, an active fork exists at cancancommunity/cancancan. The new gem is cancancan. More info is available at #994.

If your pull request or issue is still applicable, it would be really appreciated if you resubmit it to CanCanCan.

We hope to see you on the other side!