Pagination error with network_user_activities_path

0 views
Skip to first unread message

GregL

unread,
Nov 10, 2009, 5:58:25 PM11/10/09
to CommunityEngine
I found out that to visit a page with the user's in-network activity
(as opposed to all activity), you can go to

network_user_activities_path(@user)

but I get an error visiting said page (which comes out to /<username>/
activities/network):

ActionView::TemplateError (undefined method `page_count' for #<Array:
0x105891ad8>) on line #10 of vendor/plugins/community_engine/app/views/
activities/network.html.haml:
7: %h3=:activity_from_your_network.l
8: %table{:width => "100%"}
9: =render :partial => "activities/activity", :collection =>
@activities
10: -if @activities.page_count > 1
11: .pagination= paginating_links
@activities, :link_to_current_page => true
12: -else
13: =:you_have_no_network_activity_yet.l

It looks like it expects the array of activities to be a pagination
object. I'm not familiar with the pagination system, any ideas how to
fix it?

Jim Ruther Nill

unread,
Nov 10, 2009, 8:00:27 PM11/10/09
to communi...@googlegroups.com
how is @activities declared?


--

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





--
"We do not believe in ourselves until someone reveals that deep inside us is valuable, worth listening to, worthy of our trust, sacred to our touch." - E. E. Cummings

Bruno Bornsztein

unread,
Nov 10, 2009, 8:31:23 PM11/10/09
to communi...@googlegroups.com
@activities is set in activities_controller, line #9. (Please note that this action can only be accessed by the current user, so you can't look at another user's network activities).

Regarding your error: I can't reproduce it locally, and my tests pass. Please check your tests, specifically, make sure that activities_controller_test.rb runs without errors before submitting this as a bug.

Thanks,
Bruno

GregL

unread,
Nov 20, 2009, 10:07:59 PM11/20/09
to CommunityEngine
I didn't get to the bottom of this, so I had to override the template
with my own and stop calling page_count.

But your mention of trying the tests, Bruno, brought up an interesting
point. I can't in fact pass a lot of the tests anymore, because it
seems that when I run them, it will not just use the CE rails app
embedded inside my app, it will use the WHOLE APP, and so all my
changes to your behavior will break tests. I didn't try going down
into the CE directory and running the rake task from there, maybe that
would work. I guess I expected that prefixing the test with
community_engine implied it would execute those tests within a
strictly community_engine context.

On Nov 10, 8:31 pm, Bruno Bornsztein <bruno.bornszt...@gmail.com>
wrote:
> @activities is set in activities_controller, line #9. (Please note that this
> action can only be accessed by the current user, so you can't look at
> another user's network activities).
>
> Regarding your error: I can't reproduce it locally, and my tests pass.
> Please check your tests, specifically, make sure that
> activities_controller_test.rb runs without errors before submitting this as
> a bug.
>
> Thanks,
> Bruno
>
> On Tue, Nov 10, 2009 at 7:00 PM, Jim Ruther Nill <jvn...@gmail.com> wrote:
>
>
>
> > how is @activities declared?
>

Bruno Bornsztein

unread,
Nov 21, 2009, 9:10:25 AM11/21/09
to communi...@googlegroups.com
I didn't get to the bottom of this, so I had to override the template
with my own and stop calling page_count.

That's too bad; I'm guessing there's something special going on in your install to make this error appear (since I can't reproduce it and all my tests pass).
 
But your mention of trying the tests, Bruno, brought up an interesting
point. I can't in fact pass a lot of the tests anymore, because it
seems that when I run them, it will not just use the CE rails app
embedded inside my app, it will use the WHOLE APP, and so all my
changes to your behavior will break tests. I didn't try going down
into the CE directory and running the rake task from there, maybe that
would work. I guess I expected that prefixing the test with
community_engine implied it would execute those tests within a
strictly community_engine context.

This is a good question. When CE tests are run, they are NOT isolated to the CE directory (even if you run them from within CE). That's by design; if you are making changes in your app that break CE's tests, then you should know about it (since, most of the time, breaking CE's tests is a bad thing). 

Occasionally there are times when you want to change behavior a way that violates CE's tests (for example, if you don't want User to require a valid birthday, or something).

Ideally, you'd be able to override CE's user_test.rb in your application, just changing the test that tests for a valid birthday. Unfortunately, overriding tests in this way is not currently possible (as far as I know), so you just need to be aware of which tests are failing and why.

Thanks,
Bruno


 
To unsubscribe from this group, send email to communityengi...@googlegroups.com.

GregL

unread,
Dec 16, 2009, 6:10:43 PM12/16/09
to CommunityEngine
I've dug much deeper into what it's like when I run "rake
community_engine:test" in my app. The main thing I've done that breaks
about 30 of the tests is that I require a login to see anything except
the forums and the login forms. I am taking a conservative approach to
what my users will want, so profiles, photos, and whatnot are all kept
within the site for now. This manifests as many tests that get
redirected instead of getting a :success code. Others assume success
and access some data that the controller was supposed to assign, but
it is nil and the test is given an E.

The ideal solution here is for desert to extend into the tests, so
that I can trump each test case that should behave differently.

On Nov 21, 9:10 am, Bruno Bornsztein <bruno.bornszt...@gmail.com>
wrote:
> > communityengi...@googlegroups.com<communityengine%2Bunsubscribe@ googlegroups.com>
> > .

Bruno Bornsztein

unread,
Dec 17, 2009, 10:50:31 AM12/17/09
to communi...@googlegroups.com
Yeah, I hear you. Unfortunately it's just not supported in Desert (or Rails), right now. I'm keen to hear other people's suggestions on how to handle this case, since I think it's important to support customizations of CE while maintaining passing test coverage.

Thanks,
Bruno

To unsubscribe from this group, send email to communityengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/communityengine?hl=en.



Reply all
Reply to author
Forward
0 new messages