Hi Anthony,
I'm also pretty new to Rails/Hobo, but you may want to check out
find_by_sql. Given that you'll be losing database portability by
hard-coding the SQL, it's a last resort, but will let you do what you want.
Category.find_by_sql ("select ... from categories, venues, events...sort by
....", bindings)
Again, I'm new, but I think you'd put in your controller:
@json=Category.find_by_sql ("....")
Then make reference in your cards to the @json variable.
Hopefully this is a start until a more complete/better answer arrives
Best regards,
Art.
On Tuesday, January 15, 2013 3:37:04 AM UTC-6, tonym wrote:
>
> Hi All,
>
> OK, this is something I'm about to tackle, but before I start I get a
> feeling I need help ;)
> Here's the scenario...
>
> I have 3 models. 'Category' has a many to many relationship with the two
> other models (venue and event).
> I need to create a single collection (output as cards) which lists all
> venues and events, but also, each venue or event will be listed for each
> category it is in (so can be listed more than once).
> i.e.
> Event 1 (Category 1)
> Venue 1 (Category 1)
> Venue 1 (Category 3)
> Venue 2 (Category 1)
> Venue 3 (Category 2)
> Event 2 (Category 1)
> Venue 3 (Category 3)
> Event 2 (Category 2)
>
> The whole list will be sorted and filtered on various fields such as date
> and local area that they are in (as well as category).
>
> Is it possible to 'include' all the events and venues in my Category
> controller, sort them and then output the whole thing as a collection?
>
> To be honest, not entirely sure on the best way to approach this, so any
> pointers would be very welcome.
>
> And just to complicate things! I also need to do an 'outer join' on the
> venue to event relationships - is there an hobo way to do an out join?
>
> Cheers, Anthony.
>
>
>
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/hobousers/-/JF5A8iFx4fEJ.
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.