radar/by_star — Issue #10: previous(field => :somthing_else) doesn't work
Author: armelbd
Created: 2012-02-17 15:45:53+00:00
State: open

Hi,

Thanks you for your gem, it's really useful and easy to use :)
But I think there is a problem with `previous(field => :somthing_else)`
Here is a sample of code demonstrating the problem :

```ruby
previous = raw_receipts.last.previous(:field => :affected_at) do
{ :joins => :user, :conditions => ["colocation_id = ? AND is_validated = ?",self.colocation.id,0], :order => "affected_at DESC" }
end
```

I get the error :

```ruby
NoMethodError: undefined method `{:field=>:affected_at}' for #
````

To solve this issue I add `by_star_field :affected_at` to my Receipt model.
Now the generated SQL request is correct :

Receipt Load (0.3ms) SELECT "receipts".* FROM "receipts" WHERE (affected_at < '2012-02-17 15:10:01.935885') ORDER BY affected_at DESC LIMIT 1