Thanks Colin and Fred,it works with<%= comment.commenter.name if
comment.commenter %>
I still don't understand why some of the commenters are nil, but I
will take your advise and learn how to debug myself.
Thanks very much!!
On 6月7日, 下午7时28分, Colin Law wrote:
> 2011/6/7 Jeweller :
>
> > Well, I
2011/6/7 Jeweller :
> Well, I think Fred may be right. The path to my app contains some
> Chinese, like "桌面". So I removed it to another directory, but there
> came with a new error "undefined method `name' for nil:NilClass"
> instead of the old one.
As I asked previously, don't top post. Thanks.
Well, I think Fred may be right. The path to my app contains some
Chinese, like "桌面". So I removed it to another directory, but there
came with a new error "undefined method `name' for nil:NilClass"
instead of the old one.
comment.commenter is a nilclass !!!but <%= comment.commenter %> it
got
2011/6/7 Jeweller :
Could you not top post please, insert your reply at appropriate points
in the previous post, that makes it easier to follow the thread.
> Sorry, I don't know how to test it. I'm new to Rails. Could you
> specify it?
> Or let's say if you want a user able to comment on micropos
Sorry, I don't know how to test it. I'm new to Rails. Could you
specify it?
Or let's say if you want a user able to comment on microposts and also
comments, what would you do?
I just don't want to use "act_as_commentable" gem, because I'm trying
to learn
On 6月7日, 下午2时50分, Frederick Cheung wrote:
On Jun 7, 3:37 am, Jeweller wrote:
> thanks ,Fred.
> I still don't understand,because in the model I use the
> "validates_presense_of :commenter" to make sure the commenter
> won't be nil.
> Here's the file I used to generate sample data.
>
> require 'faker'
> def make_comments
> Micropost.al
thanks ,Fred.
I still don't understand,because in the model I use the
"validates_presense_of :commenter" to make sure the commenter
won't be nil.
Here's the file I used to generate sample data.
require 'faker'
def make_comments
Micropost.all.each do |micropost|
User.all(:limit => 2).each do
On Jun 6, 4:34 pm, Jeweller wrote:
>
>
> so I placed this line in the home.html.erb to test
> <%= @feed_items.first.comments.first.commenter.name %>
> it's worked!
>
> I'm very confused. I mean what's the difference between these two
> ways? And also the error message, it's very strange. becau
8 matches
Mail list logo