[Rails] Union function in model class
Hi all
Help Please!
Question : i have to union two tables named
qareports (1st table)
--------------
id
agency_id
agencies (2nd table)
-------------
id
name
#i have called model from controller by passing some parameter
reports_controller.rb
----------------------------
if @submited_status.to_i != 2
@qareports =
@qareports.submitted_reports(@submited_status)
end
qareport.rb
---------------
named_scope :unsubmitted_reports, lambda {|*args|
{
:conditions => ['locked = 0 and agency_id = ?', (args.first)]
# so i have to use union agency table here or some where
}
}
Please help!
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home