I have a user and post model:
class User < ActiveRecord::Base
has_many :sent_posts, :class_name => 'Post'
end
class Post < ActiveRecord::Base
belongs_to :user
end
The problem is that in the console, if I do
User.first.sent_posts.empty?
it returns True.
But if I do this in my view
<%= @user.sent_posts.empty? %>
it returns False. Any ideas why this is happening? It works fine if I just use
has_many :posts
on its own.
Thanks