s c wrote:> Hi everyone,
> I received an error message as below:
>
> Couldn''t find Project with ID in (''---
:all'',''--- \n:order: number ASC'')
>
> and it point to a statement in my controller:
> @projects_by_user = @an_user.projects.find(:all, :order=>"number
ASC")
>
> I checked the log file, it seems the sql statement is executed with
> returned result. Would anyone please tell me what the error stands for?
It looks like your user model contains a "has_many :projects"
declaration.
So if you''re always wanting the projects ordered in this way, just add
the order spec you''re using in the find to the has_many declaration.
If this is a special ordering, either use ruby''s dup and Array:sort!
methods to sort the projects in @an_user.projects, or (I think) it''s
OK to add a second has_many declaration such as
has_many :projects_by_number, :order=>"number ASC"
--
We develop, watch us RoR, in numbers too big to ignore.