Weird. Just went back to your original message and noticed something. Here
was your error:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.include?

Extracted source (around line #5):

2:   %dt
3:     =time_ago_in_words_or_date(
activity.created_at)
4:   %dd
5:     =link_to activity.user.login.capitalize, user_path

That nil.include? is coming from where you call
activity.user.login.capitalize. If the user doesn't have a login (maybe it
was an anonymous comment or something), then capitalize will result in that
error. Does that help?


On Thu, Feb 12, 2009 at 6:11 PM, jdutil <[email protected]> wrote:

>
> Thanks for the link Bruno it doesn't completely work out for me
> though, and I am not exactly sure why.  That allows me to edit without
> restarting, but when I refresh the page it throws an error now.  It
> may be that the caching stops my code from breaking or something I'm
> not sure.  I added comments to a custom model, and if I implement that
> method the second time I view the page showing the comments it throws
> an error.  The first time I view the page it works fine though...
> For some reason I seem to have shit luck at implementing comments on
> custom models since I went through similar issues before.  Maybe you
> can help me figure this error out or give me the required steps for
> implementing comments on custom models incase I missed something, but
> I don't think I did since they were working fine before I upgraded to
> 2.2.2
>
> This link looks like it may be related:
> http://www.ruby-forum.com/topic/178391
>
> This is the error I get:
> NoMethodError
>
> Extracted source (around line #4):
>
> 1: -if comment.user
> 2:   .hentry{:id => "comment_#{comment.id}"}
> 3:     .vcard.author
> 4:       %h5= link_to image_tag(comment.user.avatar_photo_url
> (:thumb), :height => '50', :width => '50', :alt => "#
> {comment.user.login}"), user_path(comment.user), :rel =>
> 'bookmark', :class => 'photo', :title => "#{comment.user.login}'s
> profile"
> 5:       %ul
> 6:         %li.fn
> 7:           = link_to comment.user.login, user_path
> (comment.user), :class => 'url'
>
> Backtrace:
> Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
> associations/association_proxy.rb:209:in `method_missing'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> renderable.rb:39:in `send'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> renderable.rb:39:in `render'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> renderable_partial.rb:20:in `render'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> benchmarking.rb:26:in `benchmark'
> /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> core_ext/benchmark.rb:8:in `realtime'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> benchmarking.rb:26:in `benchmark'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> renderable_partial.rb:19:in `render'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> template.rb:73:in `render_template'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> renderable_partial.rb:45:in `render_partial'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> partials.rb:184:in `render_partial_collection'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
> associations/association_collection.rb:359:in `method_missing'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
> associations/association_proxy.rb:212:in `method_missing'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
> associations/association_proxy.rb:212:in `map'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
> associations/association_proxy.rb:212:in `send'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
> associations/association_proxy.rb:212:in `method_missing'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
> associations/association_collection.rb:359:in `method_missing'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> partials.rb:179:in `render_partial_collection'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> partials.rb:150:in `render_partial'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb:
> 258:in `render_without_haml'
> /Library/Ruby/Gems/1.8/gems/haml-2.0.6/lib/haml/helpers/
> action_view_mods.rb:12:in `render'
> /Library/Ruby/Gems/1.8/gems/haml-2.0.6/lib/haml/helpers.rb:57:in
> `non_haml'
> /Library/Ruby/Gems/1.8/gems/haml-2.0.6/lib/haml/helpers/
> action_view_mods.rb:12:in `render'
> app/views/places/show.html.haml:47
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> renderable.rb:39:in `send'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> renderable.rb:39:in `render'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/
> template.rb:73:in `render_template'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb:
> 256:in `render_without_haml'
> /Library/Ruby/Gems/1.8/gems/haml-2.0.6/lib/haml/helpers/
> action_view_mods.rb:14:in `render'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb:
> 367:in `_render_with_layout'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/base.rb:
> 254:in `render_without_haml'
> /Library/Ruby/Gems/1.8/gems/haml-2.0.6/lib/haml/helpers/
> action_view_mods.rb:14:in `render'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> base.rb:1174:in `render_for_file'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> base.rb:905:in `render_without_benchmark'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> benchmarking.rb:51:in `render'
> /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> core_ext/benchmark.rb:8:in `realtime'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> benchmarking.rb:51:in `render'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> mime_responds.rb:135:in `send'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> mime_responds.rb:135:in `custom'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> mime_responds.rb:164:in `call'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> mime_responds.rb:164:in `respond'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> mime_responds.rb:158:in `each'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> mime_responds.rb:158:in `respond'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> mime_responds.rb:107:in `respond_to'
> app/controllers/places_controller.rb:35:in `show'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> base.rb:1253:in `send'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> base.rb:1253:in `perform_action_without_filters'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> filters.rb:617:in `call_filters'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> filters.rb:638:in `run_before_filters'
> /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> callbacks.rb:178:in `send'
> /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> callbacks.rb:178:in `evaluate_method'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> filters.rb:186:in `call'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> filters.rb:635:in `run_before_filters'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> filters.rb:615:in `call_filters'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> filters.rb:610:in `perform_action_without_benchmark'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> benchmarking.rb:68:in `perform_action_without_rescue'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> benchmarking.rb:68:in `perform_action_without_rescue'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> rescue.rb:136:in `perform_action_without_caching'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> caching/sql_cache.rb:13:in `perform_action'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
> connection_adapters/abstract/query_cache.rb:34:in `cache'
> /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/
> query_cache.rb:8:in `cache'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> caching/sql_cache.rb:12:in `perform_action'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> base.rb:524:in `send'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> base.rb:524:in `process_without_filters'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> filters.rb:606:in `process_without_session_management_support'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> session_management.rb:134:in `sass_old_process'
> /Library/Ruby/Gems/1.8/gems/haml-2.0.6/lib/sass/plugin/rails.rb:19:in
> `process'
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/
> base.rb:392:in `process'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in
> `process'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in
> `synchronize'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in
> `process'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in
> `process_client'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
> `process_client'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
> `initialize'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
> `initialize'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:
> 282:in `run'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:
> 281:in `each'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:
> 281:in `run'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in
> `run'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:
> 212:in `run'
> /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
> /usr/bin/mongrel_rails:19:in `load'
> /usr/bin/mongrel_rails:19
>
>
> On Feb 10, 12:55 pm, Bruno <[email protected]> wrote:
> > Try this solution instead of the cache_classes one:
> >
> > http://www.railsformers.com/article/activerecord-timezone-settings-bug
> >
> > On Feb 8, 10:23 pm, jdutil <[email protected]> wrote:
> >
> > > Unfortunately now I need to restart the server everytime I make
> > > changes.  Any ideas?
> >
> > > On Feb 8, 11:04 pm, jdutil <[email protected]> wrote:
> >
> > > > Thanks to this post I found the problem was with AR Mailer in Rails
> > > > 2.2.2:
> http://www.theirishpenguin.com/2009/01/22/bug-of-the-day-nilinclude-e...
> >
> > > > I needed to modify my environments/development.rb file to change:
> > > > config.cache_classes = false
> >
> > > > To:
> > > > config.cache_classes = true
> >
> > > > On Feb 8, 9:39 pm, jdutil <[email protected]> wrote:
> >
> > > > > Tried that it was my first thought.   I even wiped out the db and
> > > > > started a new one and got the same problem.  The activity is
> tracking
> > > > > an actual user record.
> >
> > > > > On Feb 8, 9:33 pm, Bruno Bornsztein <[email protected]>
> > > > > wrote:
> >
> > > > > > Not sure, but looks to me like you have an orphaned activity in
> the database
> > > > > > (an activity item for which the user no longer exists). Look for
> rows in the
> > > > > > activities table with a user_id that doesn't match any id in the
> users
> > > > > > table.
> >
> > > > > > On Sun, Feb 8, 2009 at 7:53 PM, jdutil <[email protected]>
> wrote:
> >
> > > > > > > Does anyone know what could be causing this.  All I did was
> comment on
> > > > > > > a users profile, and then the activities area shows a backtrace
> in
> > > > > > > other users profiles.
> >
> > > > > > >  NoMethodError in Base#footer_content
> >
> > > > > > > Showing vendor/plugins/community_engine/app/views/activities/
> > > > > > > _activity.html.haml where line #5 raised:
> >
> > > > > > > You have a nil object when you didn't expect it!
> > > > > > > You might have expected an instance of Array.
> > > > > > > The error occurred while evaluating nil.include?
> >
> > > > > > > Extracted source (around line #5):
> >
> > > > > > > 2:   %dt
> > > > > > > 3:     =time_ago_in_words_or_date(activity.created_at)
> > > > > > > 4:   %dd
> > > > > > > 5:     =link_to activity.user.login.capitalize, user_path
> > > > > > > (activity.user.login_slug)
> > > > > > > 6:     - if activity.item
> > > > > > > 7:       - case activity.item_type
> > > > > > > 8:         - when 'Post'
> >
> > > > > > > Trace of template inclusion:
> vendor/plugins/community_engine/app/views/
> > > > > > > shared/_footer_content.html.haml
> >
> > > > > > > Then When you try to view the profile you commented on you get
> this
> > > > > > > error page.
> >
> > > > > > >  NoMethodError in Users#show
> >
> > > > > > > Showing
> vendor/plugins/community_engine/app/views/users/show.html.haml
> > > > > > > where line #46 raised:
> >
> > > > > > > You have a nil object when you didn't expect it!
> > > > > > > You might have expected an instance of Array.
> > > > > > > The error occurred while evaluating nil.include?
> >
> > > > > > > Extracted source (around line #46):
> >
> > > > > > > 43:       - @users_comments.each do |comment|
> > > > > > > 44:         %dl.vcard
> > > > > > > 45:           %dt.photo
> > > > > > > 46:             = link_to
> image_tag(comment.recipient.avatar_photo_url
> > > > > > > (:thumb), :alt => "#{comment.recipient.login}", :width =>
> > > > > > > '50', :height => '50'), commentable_url(comment)
> > > > > > > 47:           %dd.fn
> > > > > > > 48:             - if
> comment.recipient.eql?(comment.commentable)
> > > > > > > 49:               %strong= :to.l + ": #{link_to
> > > > > > > comment.recipient.login, commentable_url(comment)}"
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CommunityEngine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/communityengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to