Hi,

I'm getting this problem with > 0 active users. Right now, I have 10
active users in the system, but as soon as one user signs up, the
front page (base_controller#site_index) blows up with the
"ActiveRecord::Record Not Found" error until that user activates. It's
frustrating because the normal dev will go into console and find the
user record easily, but the error says it can't find it.

What's going on:

- site_index calls get_additional_homepage_data, which calls
User.active.find_by_activity

- By scoping to active users, the only users which can be searched on
are active users

- however, in the find_by_activity method, activities are selected
without regard for whether or not their associated user has been
activiated

- when the activities look up each user by the user id of the
activity, it blows up because all inactive users were excluded via the
active scoping

This could be fixed simply by removing the active scope in
get_additional_homepage_data, OR by putting a condition in the
Activity select in find_by_activity to exclude inactive users. I
wonder what the original intent was here.

- Jeremy


On Oct 14, 4:24 pm, Rama McIntosh <[email protected]> wrote:
> Hi Dan,
>
> This rings a bell.   I think it is because you didn't activate your
> first user via the email
> link, so the system has noactiveusers.      There is a named scope in
> user.rb
> (named_scope :active, :conditions => ["users.activated_at IS NOT NULL"]
> ) that
> will blow up if you have 0activeusers when the system tries
> "User.active.find"....
>
> If you click on the activation email it should fix the problem.    
> Another hack is to
> change your first user via sql to have a activated_at date if you don't
> have the email.
> This should only be a problem on a new install with 0 "active" users.
>
> Thanks,
> -Rama
>
> DBarrett83 wrote:
> > I'm having the same issue. I was excited to get community engine up
> > and running and created the first user account with my info.
> > Refreshing the page brought a similar error message:
>
> > ActiveRecord::RecordNotFound in BaseController#site_index
>
> > Couldn't find User with ID=1
>
> > RAILS_ROOT: J:/Users/Dan/community_engine
>
> > Application Trace
>
> > D:/Programs/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
> > active_record/base.rb:1586:in `find_one'
> > D:/Programs/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
> > active_record/base.rb:1569:in `find_from_ids'
> > D:/Programs/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
> > active_record/base.rb:616:in `find_without_pagination'
> > J:/Users/Dan/community_engine/vendor/plugins/community_engine/plugins/
> > paginating_find/lib/paginating_find.rb:103:in `find'
> > J:/Users/Dan/community_engine/vendor/plugins/community_engine/app/
> > models/user.rb:93:in `find'
> > J:/Users/Dan/community_engine/vendor/plugins/community_engine/app/
> > models/user.rb:165:in `find_by_activity'
> > J:/Users/Dan/community_engine/vendor/plugins/community_engine/app/
> > models/user.rb:165:in `map'
> > J:/Users/Dan/community_engine/vendor/plugins/community_engine/app/
> > models/user.rb:165:in `find_by_activity'
> > D:/Programs/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
> > active_record/named_scope.rb:181:in `send'
> > D:/Programs/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
> > active_record/named_scope.rb:181:in `method_missing'
> > D:/Programs/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
> > active_record/base.rb:2143:in `with_scope'
> > D:1:in `__send__'
> > D:1:in `with_scope'
>
> > If anyone has any ideas, please let me know. It could be my fault, as
> > I am a total noob and did not successfullt run "rake test" after
> > install (nor would I know exactly how to troubleshoot errors anyway).
>
> > Thanks,
>
> > Dan Barrett
> > [email protected]
>
> > On Oct 8, 7:17 am, khelll <[email protected]> wrote:
>
> >> I'm using the last version of community engine, after theuser
> >> registers, and tries to go to any page without activating his email,
> >> an error shows:
>
> >> ActiveRecord::RecordNotFound (Couldn'tfindUserwith ID=3):
> >>   vendor/plugins/community_engine/plugins/paginating_find/lib/
> >> paginating_find.rb:103:in `find'
> >>   vendor/plugins/community_engine/app/models/user.rb:93:in `find'
> >>   vendor/plugins/community_engine/app/models/user.rb:165:in
> >> `find_by_activity'
> >>   vendor/plugins/community_engine/app/models/user.rb:165:in `map'
> >>   vendor/plugins/community_engine/app/models/user.rb:165:in
> >> `find_by_activity'

--

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


Reply via email to