Displaying 2 results from an estimated 2 matches for "users_posts".
Did you mean:
user_posts
2006 Jul 04
8
writing to many_to_many table
I have three tables. users, posts, users_posts. This last one is to
mark a post as read.
How do I write to the users_post table?
Here''s what I have:
In model ''User_Post''
belongs_to :post
belongs_to :user
In post/view/show:
<%= link_to "Mark As Read", :controller => ''post'', :acti...
2008 Sep 19
1
Help with best approach(fairly easy question)
...l the users on a group. The
route is:
users/1/posts
The thing is that I want to show too, all the posts from any user, or
all the posts for a given tag or category. So my question is, which
option should I use:
1) Should I send some extra parameters to my index action, like and id
or something:
users_posts(user.id,{:category => 1})
and check on the controller which posts should be shown (for a user,
group, tag, category etc...)
Something like this:
def index
if params[:category]
@posts = Posts.find(:all, :conditions => ["category_id = ?,
params[:category]])
elsif params[:user]...