class Tweet < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
has_many :tweets
has_many :followers
has_many :followed_users
def recent_tweets
tweets.where("created_at > ?", 2.weeks.ago)
end
end
Tweet from <%= @tweet.username %>
<%= @tweet.text %>
class TweetsController < ApplicationController
def index
@tweets = Tweets.all
end
end