Yes, the models are only indirectly involved so I use direct SQL. I
need to join different tables and have a query taking quite long...
Imagine we have three models, People, Cities, Countries.
The People belongs to a City.
The City belongs to a Country (Country has many Cities)
In my country index page I want now to display a part which only loads
on request.
Regard the query as a database sanity checker because the data is not
populated by hobo, but externally.
def unassigned
tmp = People.find_by_sql("SELECT DISTINCT `cities` FROM `people`
WHERE NOT EXISTS.
(SELECT * FROM `cities`
JOIN `countries` ON `cities`.`country_id` = `country`.`id`
WHERE `people`.`city` = `city`.`name`)")
@unassigned = String.new
tmp.each do |x|
@unassigned += x.city + ", " unless x.city.nil?
end
render :partial => "unassigned", :object => @unassigned <--- I
want to replace this all by a hobo way...
end
This query will determine all cities which are either currently not
assigned to a country, or cities which are not even defined in the
cities table.
Best regards,
Sebastian
On 13 Jun., 01:03, Owen Dall <[email protected]> wrote:
> Sebastian,
>
> Can you explain a little more about what you are trying to accomplish in
> terms of your model relationships. Or are you dropping down to actual SQL
> and what to make a tag for that?
>
> -Owen
>
>
>
> On Sat, Jun 12, 2010 at 7:40 AM, Togg <[email protected]> wrote:
> > Hi all,
>
> > I tried to use <do part="my-part"> to update div on request when I
> > click a button, but it didn't work.
> > Basically the div is initially empty, and only on request I want to
> > start the time consuming SQL query and display the result (also have
> > indicator that the request is still processing maybe)
>
> > Can someone post a short example how to do this correctly?
>
> > Best regards,
> > Sebastian
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Hobo Users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<hobousers%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/hobousers?hl=en.
>
> --
> - Owen
>
> Owen Dall, Chief Systems Architect
> Barquin International
> Cell: 410-991-0811
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" 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/hobousers?hl=en.