Displaying 5 results from an estimated 5 matches for "user_posts".
2006 Jun 28
2
models @ data extraction
I''m building my first webapp...
I have db tables "users" and "posts". Model for user is "has_many
:posts". Model for post is "belongs_to :user"
In a slightly modified scaffold I can list all the posts and which user
wrote them (/post/list), but want to link the username to a list of
posts by that user.
How do I accomplish that?
Sorry for the
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'', :action =>
''post_read'',
:user =>
2008 Nov 27
7
will_paginate issue
Hi,
I am trying paginate (will_paginate) users posts. It is counting and
showing the page links correctly, but still showing all the posts on one
page.
@entries = @user.entries.paginate :per_page => 5, :page =>
params[:page], :order => ''created_at DESC''
If I change it to @entries = Entry.paginate :per_page => 5 ........
It is fine, but I would like to show only
2008 Sep 19
1
Help with best approach(fairly easy question)
...ts = Posts.find(:all, :conditions => ["user_id = ?,
params[:user_id]])
elsif params[:tag]
.
.
.
end
2) Should I create different controllers with only an index action on
it (Create and other actions stay on the posts_controller):
post_categories controller? post_tags controller? user_posts
controller?
So, which approach should I use?
Thanks again,
Elioncho
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA3...
2010 Jan 27
2
has_many, through with nested models?
First the data model:
class Forum < ActiveRecord::Base
has_many :topics, :dependent => :destroy, :order => ''created_at
desc''
end
class User < ActiveRecord::Base
has_many :topics, :dependent => :destroy
has_many :comments, :dependent => :destroy
has_many :replies, :dependent => :destroy
end
class Topic < ActiveRecord::Base
belongs_to