On Thu, Aug 12, 2010 at 11:25 PM, Mohammed Alenazi <[email protected]> wrote: > There is still a problem. > �...@users = User.paginate :joins => :properties ,:select => 'distinct > users.*', :page => params[:page], :order => 'properties.id > DESC',:conditions => ['users.id != 1'] > I got this error message. > ActiveRecord::StatementInvalid (PGError: ERROR: for SELECT DISTINCT, > ORDER BY expressions must appear in select list > : SELECT distinct users.* FROM "users" INNER JOIN "properties" ON > properties.user_id = users.id WHERE (users.id != 1) ORDER BY > properties.id DESC LIMIT 10 OFFSET 0):
Leaving out pagination and the "users.id != 1" stuff for the moment -- does something like @users = User.all(:include => :properties, :order => 'properties.id DESC') give you the expected data result? -- Hassan Schroeder ------------------------ [email protected] twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en.

