[Rails] Re: need help with an awkard error

2011-06-07 Thread Jeweller
frederick.che...@gmail.com wrote: On Jun 7, 3:37 am, Jeweller jiangna...@gmail.com 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

[Rails] Re: need help with an awkard error

2011-06-07 Thread Jeweller
, :foreign_key = commenter_id has_many :comments, :as = :commentable, :dependent = :destroy # A comment can also be commented #... end On 6月7日, 下午5时06分, Colin Law clan...@googlemail.com wrote: 2011/6/7 Jeweller jiangna...@gmail.com: Could you not top post please, insert your reply at appropriate

[Rails] Re: need help with an awkard error

2011-06-07 Thread Jeweller
Jeweller jiangna...@gmail.com: 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

[Rails] need help with an awkard error

2011-06-06 Thread Jeweller
Hi, everyone. Need help here. the basic relationship is that a user has many microposts and comments, a micropost has many comments. What I want to do is to show a commenter's name in the brower. Here's the code: # pagesController.rb # the feed method is to retrun some reletive microposts

[Rails] Re: need help with an awkard error

2011-06-06 Thread Jeweller
app contain some non ASCII characters On 6月7日, 上午2时29分, Frederick Cheung frederick.che...@gmail.com wrote: On Jun 6, 4:34 pm, Jeweller jiangna...@gmail.com 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