On 25 November 2015 at 15:50, fugee ohu <
fuge...@gmail.com> wrote:
> i wanna display listings for that current category and all it's child
> categories (if any) and in the sidebar i wanna display the child categories
But why are you having to reference the id? What are you trying to
get with the query you showed?
Colin
>
> On Wednesday, November 25, 2015 at 8:39:05 AM UTC-5, Colin Law wrote:
>>
>> On 25 November 2015 at 12:31, fugee ohu <
fuge...@gmail.com> wrote:
>> > i'm trying to create an sql select from listings like this
>> > `@listings=Listing.where("category_id in [1, 2, etc.])`
>> > i'm using awesome_nested_set and it has a "children" method helper for
>> > the
>> > Category model that returns all the children categories in an array I
>> > was
>> > thinking i have to step through the array to build a string to insert
>> > into
>> > my sql select statement, but i don't wanna re-invent the wheel Since
>> > this is
>> > so common maybe there's a method already written for this?
>>
>> As I said in a previous post, if you are explicitly using
model.id you
>> are probably not doing things the best way. Please provide details of
>> why you need to do this. There is almost certainly a better way.
>>
>> Colin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to
rubyonra...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/rubyonrails-talk/562acce2-65e9-4c45-a376-03c14ccc7835%40googlegroups.com.
>
> For more options, visit
https://groups.google.com/d/optout.