Simple question. I’m a newbie with rails and just need to restrict the
results of a query (a where clause in SQL). I am building a simple
application that enables the user to add pages and post comments to each
page. I have build a table for pages and posts and have related the two
models (one page to many posts). When a user is on a page, I just want
the list of posts to be restricted to the posts made for that particular
page. Here is what it would look like in SQL:
select * from posts where posts.pageid = {this.pageid}
What should the syntax look like? Where would I restrict the results (in
the controller or the model)?
Thanks.