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 @feed_items=current_user.feed.paginate(:page=>params[:page]) # home.html.erb <%= render :partial=>''shared/feed_item'', :collection=>@feed_items %> # _feed_item.html.erb <% for comment in feed_item.comments %> <% comment.commenter.name %> # this line cause the error, but <% comment.commenter %> is ok! <% end %> there''s an error " Error during failsafe response: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)" rror during failsafe response: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string) /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/ backtrace_cleaner.rb:10:in `sub'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/ backtrace_cleaner.rb:10:in `block in initialize'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/ active_support/backtrace_cleaner.rb:72:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/ active_support/backtrace_cleaner.rb:72:in `block (2 levels) in filter'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/ active_support/backtrace_cleaner.rb:72:in `map'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/ active_support/backtrace_cleaner.rb:72:in `block in filter'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/ active_support/backtrace_cleaner.rb:71:in `each'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/ active_support/backtrace_cleaner.rb:71:in `filter'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/ active_support/backtrace_cleaner.rb:26:in `clean'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/ action_dispatch/middleware/show_exceptions.rb:150:in `clean_backtrace'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/ action_dispatch/middleware/show_exceptions.rb:137:in `application_trace'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/ action_dispatch/middleware/show_exceptions.rb:131:in `block in log_error'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/ active_support/deprecation/reporting.rb:16:in `silence'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/ action_dispatch/middleware/show_exceptions.rb:128:in `log_error'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/ action_dispatch/middleware/show_exceptions.rb:64:in `render_exception'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/ action_dispatch/middleware/show_exceptions.rb:59:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/ rack/logger.rb:13:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/ runtime.rb:17:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/lib/ active_support/cache/strategy/local_cache.rb:72:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/lock.rb: 11:in `block in call'' <internal:prelude>:10:in `synchronize'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/lock.rb: 11:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/ action_dispatch/middleware/static.rb:30:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/ application.rb:168:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/ application.rb:77:in `method_missing'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/ rack/log_tailer.rb:14:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/ content_length.rb:13:in `call'' /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.2.3/lib/rack/handler/ webrick.rb:52:in `service'' /usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'' /usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'' /usr/local/ruby/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'' 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. because I''ve specified utf-8 encoding in the database.yml -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 6, 4:34 pm, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. because I''ve > specified utf-8 encoding in the database.ymlWell the main difference is that this is only displaying a single name. If for example there is a comment where comment.commenter is nil then calling .name on it would raise an error but your second example would be ok unless the bad comment happens to be the first comment of the first item. I think the actual error message you get is something unrelated happening during the process of preparing the error page. Does the path to your rails app contain some non ASCII characters perhaps? Fred. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 |user| micropost.comments.create!(:content => Faker::Lorem.sentence(4), :commenter => user) end end end Now, every micropost has two comments, and the commenters are the first,and the second one in the database. In your opinon, what may brings to the situation ---" the path to your rails app contain some non ASCII characters" On 6月7日, 上午2时29分, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jun 6, 4:34 pm, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. because I''ve > > specified utf-8 encoding in the database.yml > > Well the main difference is that this is only displaying a single > name. If for example there is a comment where comment.commenter is nil > then calling .name on it would raise an error but your second example > would be ok unless the bad comment happens to be the first comment of > the first item. > > I think the actual error message you get is something unrelated > happening during the process of preparing the error page. Does the > path to your rails app contain some non ASCII characters perhaps? > > Fred.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 7, 3:37 am, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.all.each do |micropost| > User.all(:limit => 2).each do |user| > micropost.comments.create!(:content => > Faker::Lorem.sentence(4), :commenter => user) > end > end > end > > Now, every micropost has two comments, and the commenters are the > first,and the second one in the database. > > In your opinon, what may brings to the situation ---" the path to your > rails app contain some non ASCII characters"I don''t think it''s related to the actual problem in your app but I do think it could be triggering a bug in the backtrace cleaner stuff in rails, which is obscuring the actual error you get. Should be easy enough to test this hypothesis Fred> > On 6月7日, 上午2时29分, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On Jun 6, 4:34 pm, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. because I''ve > > > specified utf-8 encoding in the database.yml > > > Well the main difference is that this is only displaying a single > > name. If for example there is a comment where comment.commenter is nil > > then calling .name on it would raise an error but your second example > > would be ok unless the bad comment happens to be the first comment of > > the first item. > > > I think the actual error message you get is something unrelated > > happening during the process of preparing the error page. Does the > > path to your rails app contain some non ASCII characters perhaps? > > > Fred.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jun 7, 3:37 am, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.all.each do |micropost| > > User.all(:limit => 2).each do |user| > > micropost.comments.create!(:content => > > Faker::Lorem.sentence(4), :commenter => user) > > end > > end > > end > > > Now, every micropost has two comments, and the commenters are the > > first,and the second one in the database. > > > In your opinon, what may brings to the situation ---" the path to your > > rails app contain some non ASCII characters" > > I don''t think it''s related to the actual problem in your app but I do > think it could be triggering a bug in the backtrace cleaner stuff in > rails, which is obscuring the actual error you get. Should be easy > enough to test this hypothesis > > Fred > > > > > > > > > > > On 6月7日, 上午2时29分, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On Jun 6, 4:34 pm, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. because I''ve > > > > specified utf-8 encoding in the database.yml > > > > Well the main difference is that this is only displaying a single > > > name. If for example there is a comment where comment.commenter is nil > > > then calling .name on it would raise an error but your second example > > > would be ok unless the bad comment happens to be the first comment of > > > the first item. > > > > I think the actual error message you get is something unrelated > > > happening during the process of preparing the error page. Does the > > > path to your rails app contain some non ASCII characters perhaps? > > > > Fred.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2011/6/7 Jeweller <jiangnan34-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: 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 microposts and also > comments, what would you do? > I just don''t want to use "act_as_commentable" gem, because I''m trying > to learnI think Frederick is suggesting that there may be some unusual characters in the path to your app that is causing the unusual error messages. What is the path to the app (something like /home/jeweller/myapp for example)? If there are such characters then the easy test to see if this is the problem is to copy the entire app to a different location and run it there (or just rename folders to ascii text). Colin> > On 6月7日, 下午2时50分, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On Jun 7, 3:37 am, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.all.each do |micropost| >> > User.all(:limit => 2).each do |user| >> > micropost.comments.create!(:content => >> > Faker::Lorem.sentence(4), :commenter => user) >> > end >> > end >> > end >> >> > Now, every micropost has two comments, and the commenters are the >> > first,and the second one in the database. >> >> > In your opinon, what may brings to the situation ---" the path to your >> > rails app contain some non ASCII characters" >> >> I don''t think it''s related to the actual problem in your app but I do >> think it could be triggering a bug in the backtrace cleaner stuff in >> rails, which is obscuring the actual error you get. Should be easy >> enough to test this hypothesis >> >> Fred >> >> >> >> >> >> >> >> >> >> > On 6月7日, 上午2时29分, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> > > On Jun 6, 4:34 pm, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. because I''ve >> > > > specified utf-8 encoding in the database.yml >> >> > > Well the main difference is that this is only displaying a single >> > > name. If for example there is a comment where comment.commenter is nil >> > > then calling .name on it would raise an error but your second example >> > > would be ok unless the bad comment happens to be the first comment of >> > > the first item. >> >> > > I think the actual error message you get is something unrelated >> > > happening during the process of preparing the error page. Does the >> > > path to your rails app contain some non ASCII characters perhaps? >> >> > > Fred. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 #<User:0xa86725c> here is the model,there may be some problem. class User < ActiveRecord::Base has_many :comments, :dependent => :destory #... end class Comment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true belongs_to :micropost belongs_to :commenter, :class_name => "User", :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...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > 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 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 > > I think Frederick is suggesting that there may be some unusual > characters in the path to your app that is causing the unusual error > messages. What is the path to the app (something like > /home/jeweller/myapp for example)? > > If there are such characters then the easy test to see if this is the > problem is to copy the entire app to a different location and run it > there (or just rename folders to ascii text). > > Colin > > > > > > > On 6月7日, 下午2时50分, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> On Jun 7, 3:37 am, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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.all.each do |micropost| > >> > User.all(:limit => 2).each do |user| > >> > micropost.comments.create!(:content => > >> > Faker::Lorem.sentence(4), :commenter => user) > >> > end > >> > end > >> > end > > >> > Now, every micropost has two comments, and the commenters are the > >> > first,and the second one in the database. > > >> > In your opinon, what may brings to the situation ---" the path to your > >> > rails app contain some non ASCII characters" > > >> I don''t think it''s related to the actual problem in your app but I do > >> think it could be triggering a bug in the backtrace cleaner stuff in > >> rails, which is obscuring the actual error you get. Should be easy > >> enough to test this hypothesis > > >> Fred > > >> > On 6月7日, 上午2时29分, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> > > On Jun 6, 4:34 pm, Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. because I''ve > >> > > > specified utf-8 encoding in the database.yml > > >> > > Well the main difference is that this is only displaying a single > >> > > name. If for example there is a comment where comment.commenter is nil > >> > > then calling .name on it would raise an error but your second example > >> > > would be ok unless the bad comment happens to be the first comment of > >> > > the first item. > > >> > > I think the actual error message you get is something unrelated > >> > > happening during the process of preparing the error page. Does the > >> > > path to your rails app contain some non ASCII characters perhaps? > > >> > > Fred. > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.- 隐藏被引用文字 - > > - 显示引用的文字 --- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2011/6/7 Jeweller <jiangnan34-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> 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.> > comment.commenter is a nilclass !!! but <%= comment.commenter %> it > got #<User:0xa86725c>I think you must be mistaken, it cannot both be nil and User at the same time. As fred suggested, maybe some are ok and others are nil. Try using something like <%= comment.commenter.name if comment.commenter %> Also have a look at the Rails Guide on debugging. It will show you how to use ruby-debug to break into your code and inspect data and follow flow. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2011/6/7 Jeweller <jiangna...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > 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. > > > > > comment.commenter is a nilclass !!! but <%= comment.commenter %> it > > got #<User:0xa86725c> > > I think you must be mistaken, it cannot both be nil and User at the > same time. As fred suggested, maybe some are ok and others are nil. > Try using something like > <%= comment.commenter.name if comment.commenter %> > Also have a look at the Rails Guide on debugging. It will show you > how to use ruby-debug to break into your code and inspect data and > follow flow. > > Colin-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.