[Rails] Re: need help with an awkard error

2011-06-07 Thread Jeweller
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

Re: [Rails] Re: need help with an awkard error

2011-06-07 Thread Colin Law
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.

[Rails] Re: need help with an awkard error

2011-06-07 Thread 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. comment.commenter is a nilclass !!!but <%= comment.commenter %> it got

Re: [Rails] Re: need help with an awkard error

2011-06-07 Thread Colin Law
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

[Rails] Re: need help with an awkard error

2011-06-07 Thread Jeweller
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:

[Rails] Re: need help with an awkard error

2011-06-06 Thread Frederick Cheung
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

[Rails] Re: need help with an awkard error

2011-06-06 Thread Jeweller
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

[Rails] Re: need help with an awkard error

2011-06-06 Thread Frederick Cheung
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