On 25 November 2015 at 09:40, fugee ohu <
fuge...@gmail.com> wrote:
> On Wednesday, November 25, 2015 at 4:16:57 AM UTC-5, Colin Law wrote:
>>
>> On 25 November 2015 at 08:52, fugee ohu <
fuge...@gmail.com> wrote:
>> > I wanna display categories in the side pane and listings in the main,
>> > both
>> > divisions of the same layout How would I do that?
>>
>> Using CSS probably.
>>
>> Colin
>
>
> Of course, the listings and categories are related ha ha I wanna show the
> listings for the category in the main and the sub-categories of that
> category in the side Problem is that there's 2 controllers involved, I
> dunno how to invoke them both to render to the same layout either directly
> or through partials
You are confused about the MVC model. You can access any model you
like in a controller and setup the data for both panes of the view.
What are the relationships between the various models (categories,
listings, sub-categories or whatever)? Getting those right is
crucial. If Category is a self referential model then it is important
to specify that correctly to save yourself a lot of work. Google for
rails self referential models if you don't know how to do it. If you
find yourself accessing category.parent_id in the code then you are
almost certainly not got it right.
By the way, it would not hurt to say thanks occasionally to those who
try to help you here.
>
> (By the way, I have read a rails book, Agile Web Dev ... and I've read
> chapters 7-10 from the tutorial you've been referring me to )
:)
Colin