A couple of things.

1. Do you definitely have dm-aggregates included?
2. Shouldn't the second condition be lt, not gt?

all(:max_user.gt => 0, :max_user.gt => Feature.runtime_features.count())



On 31/12/2011, at 2:32 AM, Philipp Kursawe wrote:

> Currently the output is that the method count is not part of
> RuntimeFeature, which is of course not the case.
> 
> irb(main):001:0> l = License.first ~ (0.000000) SELECT "id",
> "valid_till", "serial", "max_user", "created_at", "updated_at",
> "customer_id" FROM "licenses" ORDER BY "id" LIMIT 1=> #<License @id=1
> @valid_till=nil @serial=nil @max_user=nil @created_at=Mon, 19 Dec 2011
> 05:33:19 +0100 @updated_at=Mon, 19 Dec 2011 05:33:19 +0100
> @customer_id=1>irb(main):002:0> l.features ~ (0.000000) SELECT "id",
> "max_user", "valid_till", "created_at", "updated_at", "license_id",
> "slot_id" FROM "features" WHERE "license_id" = 1 ORDER BY "id"=>
> [#<Feature @id=1 @max_user=2 @valid_till=nil @created_at=Thu, 29 Dec
> 2011 17:04:33 +0100 @updated_at=Thu, 29 Dec 2011 17:07:09 +0100
> @license_id=1 @slot_id=82>]irb(main):003:0>
> l.features.restrictedNoMethodError: undefined property or relationship
> 'count' on RuntimeFeature
> On Dec 30, 3:09 pm, Philipp Kursawe <[email protected]> wrote:
>> On Dec 30, 3:01 pm, Chris Corbyn <[email protected]> wrote:
>> 
>>>> The restricted method if Feature should only return the Features that
>>>> have not exceeded its max_user count.
>> 
>>> And what happens instead?  What specifically are you asking?
>> 
>> What happens is that all() returns an empty array, although it should
>> contain 1 Feature.
>> The thing is, no SQL is dumped to the console as usual, so I guess
>> there is some kind of internal error.
>> 
>> But you say the syntax is correct and it should work?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/datamapper?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to