On 5 August 2010 07:58, senthilkumar <[email protected]> wrote:
> Hi all
>
> Help Please!
>
> Question : i have to union two tables named
>
> qareports (1st table)
> --------------
> id
> agency_id
>
> agencies (2nd table)
> -------------
> id
> name
What relationships have you specified in the models (has_many, belongs_to etc)?
>
> #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|
Why is this unsubmitted_reports but above you have submitted_reports?
> {
> :conditions => ['locked = 0 and agency_id = ?', (args.first)]
What is this 'locked'. I do not see it in either table?
> # so i have to use union agency table here or some where
Can you explain in words what you are trying to achieve here?
Possibly something like 'find all gareports for a particular agency
where gareport.locked is 0'.
Colin
> }
> }
>
> 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 [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.
>
>
--
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.