On Mon, 2008-06-16 at 20:00 +0100, Andrew Neil wrote:
> Nate,
> 
> Did you make any headway on this?
> 

I have completely erased all traces of the subscriber-lists extension
from the database and the radiant app. Then I re-installed the extension
from scratch and created a new subscriber-lists page. Before I created
the that page I could go to the admin page linked to by the
"Subscribers" tab at the top of the page, but once I ran the rake task
to create the new subscriber-lists page I got the "undefined method
`count_active_subscribers' for #<Class:0x7f3b1cb88a68>" error.

If I take out the "<%= Subscriber.count_active_subscribers(list) %>"
string (correct term?), then the page will load just fine. For some
strange reason the list is not getting passed into the
count-active-subscribers method.

> Try running this in script/console:
> 
>  >> s = Page.find_by_class_name("SubscriberListPage")
> => #<SubscriberListPage id: 11, title: "Newsletter", slug:  
> "newsletter", breadcrumb: "Newsletter", class_name:  
> "SubscriberListPage", status_id: 100, parent_id: 1, layout_id: nil,  
> created_at: "2008-06-15 14:38:39", updated_at: "2008-06-15 14:38:39",  
> published_at: "2008-06-15 15:38:39", created_by_id: nil,  
> updated_by_id: nil, virtual: false, lock_version: 0, description: nil,  
> keywords: nil>
>  >> Subscriber.count_active_subscribers(s)
> => 0
> 

This is what I get at the console:

 #<SubscriberListPage id: 55, title: "Newsletter", slug: "newsletter",
breadcrumb: "Newsletter", class_name: "SubscriberListPage", status_id:
100, parent_id: 1, layout_id: nil, created_at: "2008-06-17 01:50:07",
updated_at: "2008-06-17 01:50:07", published_at: "2008-06-16 20:50:07",
created_by_id: nil, updated_by_id: nil, virtual: false, lock_version: 1,
description: nil, keywords: nil, position: 1,
sent_as_newsletter_email_at: nil>


> I'm afraid I can't reproduce the error, and I am also using Radiant  
> 0.6.7, Rails 2.0.2. What database are you using? I've only tested on  
> MySQL.
> 

And now I am kicking myself for not using MySQL. "Hey, I have never
tried Sqlite before. What the heck?" NEVER again.

> Looking at the definition of the method count_active_subscribers, I'm  
> wondering if it is MySQL specific:
> 
>      def count_active_subscribers(subscriber_list)
>        count(:conditions => ["unsubscribed_at IS ? AND  
> subscriber_list_id = ?", nil, subscriber_list.id])
>      end
> 
> I'm not certain whether this would work with, say SqlLite. Even so,  
> the error message says undefined method, which is surprising since the  
> method is defined in the Subscriber model.

Anybody have any clue about this? Actually, the newer method you
modified is thus:

def count_active_subscribers(subscriber_list)
 count(:conditions => {:unsubscribed_at => nil, :subscriber_list_id =>
subscriber_list.id })
end

Any help from anybody would be greatly appreciated.



~Nate

_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to