# Re: Need a little more newsletter\_extension help

**URL:** <https://www.ruby-forum.com/t/re-need-a-little-more-newsletter-extension-help/150579>\
**Category:** Radiant CMS\
**Created:** [October 10, 2008, 6:06am UTC](https://www.ruby-forum.com/t/re-need-a-little-more-newsletter-extension-help/150579 "2008-10-10T06:06:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nateless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nateless](https://www.ruby-forum.com/u/nateless)\
**Post date:** [October 10, 2008, 6:06am UTC](https://www.ruby-forum.com/t/re-need-a-little-more-newsletter-extension-help/150579/1 "2008-10-10T06:06:43Z")

</div>

On Thu, Oct 9, 2008 at 9:38 PM, Nate T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Can somebody tell me what magical incantation I need to put in my  
> environment.rb to get the 2.2.2 will\_paginate gem working?

Sorry for the noise. I just used the tar archive and it worked.

It looks to me like I have set things up for data collection the way I  
want  
it to work, but now I have an issue with validation. At the top of the  
form  
in the “subscribe” tab on the newsletter page these tags are present:

\<r:newsletter:if\_form\_errors\>  
All fields are required  
\</r:newsletter:if\_form\_errors\>

Can anybody tell me where in the various files in the extension a form  
built  
on that page runs it’s validation checks? I have looked in every file,  
except the tests, for some clue as to what would make that tag visible,  
but  
I cannot find anything. There is no mention of it in the tags available  
for  
the page.

Honestly, I cannot figure out which controller and model combo even  
processes the form. I can figure out how the admin side of the extension  
works (for the most part), including where the validation happens, but I  
don’t understand how the info is validated and processed on the client  
facing side.

If anybody could give me some pointers on this, I promise that I will do  
my  
best to write up some documentation on the summer reboot site about how  
this  
extension works. In fact, I will also document my experience with the  
subscriber\_list (based on newsletter) and database\_form extensions as  
well.  
Adding the seemingly simple “sign the guestbook” type of functionality  
to a  
Radiant site is a deceptively complex task and I will do my part to try  
and  
reduce the pain in the process.

But first, I must conquer this newsletter extension. Any help is of  
course  
greatly appreciated and I will light a candle in your honor. In fact, I  
will  
light two. I am a desperate man. Obiwon Kinobi, you’re my only hope…

~Nate

---

<div class="post-metadata">

**Author:** ![nateless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nateless](https://www.ruby-forum.com/u/nateless)\
**Post date:** [October 10, 2008, 10:26am UTC](https://www.ruby-forum.com/t/re-need-a-little-more-newsletter-extension-help/150579/2 "2008-10-10T10:26:53Z")

</div>

On Fri, Oct 10, 2008 at 5:06 AM, Nate T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> in the “subscribe” tab on the newsletter page these tags are present:  
> the page.
> 
> Honestly, I cannot figure out which controller and model combo even  
> processes the form. I can figure out how the admin side of the extension  
> works (for the most part), including where the validation happens, but I  
> don’t understand how the info is validated and processed on the client  
> facing side.

Take a look at the process method of the newsletter\_page model

> <https://github.com/gravityblast/radiant-newsletter/blob/master/app/models/newsletter_page.rb#L43-81>

This big method holds a lot of logic, which is sort of equivalent to  
what a  
controller would normally do. The actual validations belong in the  
newsletter\_subscriber model:

> <https://github.com/gravityblast/radiant-newsletter/blob/master/app/models/newsletter_subscriber.rb>

and these are triggered when the model is saved.

I don’t have time to offer any more advice just now, but here is a tip:  
when  
your finding your way around someone else’s code, the debugger is your  
friend. Check out this article:

```
http://guides.rails.info/debugging/debugging_rails_applications.html

```

In short:

```
sudo gem install ruby-debug

```

Add this line to your /config/environments/development.rb:

```
require 'ruby-debug'

```

Then insert the line:

```
debugger

```

at the top of the process action. Restart your development environment.  
Submit the form, and the code should stop at the break point. You can  
step  
through the rest of the action line by line, enter ‘irb’ and examine all  
the  
variables in that context, etc.

Good luck.

Drew

---

<div class="post-metadata">

**Author:** ![nateless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nateless](https://www.ruby-forum.com/u/nateless)\
**Post date:** [October 10, 2008, 5:12pm UTC](https://www.ruby-forum.com/t/re-need-a-little-more-newsletter-extension-help/150579/3 "2008-10-10T17:12:16Z")

</div>

On Fri, Oct 10, 2008 at 09:26:26AM +0100, Andrew N. wrote:

> Add this line to your /config/environments/development.rb:  
> variables in that context, etc.  
> Drew - Thanks for the tip. I’ve wanted to figure out how to debug some  
> things in rails, but the pain was too small to motivate me to find what  
> I needed. You’ve done it for me. Thanks!

Bill

---

<div class="post-metadata">

**Author:** ![nateless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nateless](https://www.ruby-forum.com/u/nateless)\
**Post date:** [October 10, 2008, 5:44pm UTC](https://www.ruby-forum.com/t/re-need-a-little-more-newsletter-extension-help/150579/4 "2008-10-10T17:44:31Z")

</div>

Hi Bill,

Bill B. wrote:

> Drew - Thanks for the tip. I’ve wanted to figure out how to debug some  
> things in rails, but the pain was too small to motivate me to find what  
> I needed. You’ve done it for me. Thanks!

As you know, the Summer Reboot project is ongoing. This is certainly a  
useful extension, especially in your kind of use-case. Any chance I  
could ask you to document something related to the extension if/ when  
you get time?

In the meanwhile, I wrote this - just want a quick opinion if I should  
push into the Summer? I still need to make a few pictures for it so  
that it’s easier to follow. Comments appreciated.  
[http://www.onghu.com/radiant\_summer/radiant\_intro\_1.html](http://www.onghu.com/radiant_summer/radiant_intro_1.html)

I’m hoping to do a few more in this vein for people who are completely  
new to Radiant.

Thanks  
Mohit.

---

<div class="post-metadata">

**Author:** ![nateless](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nateless](https://www.ruby-forum.com/u/nateless)\
**Post date:** [October 10, 2008, 5:46pm UTC](https://www.ruby-forum.com/t/re-need-a-little-more-newsletter-extension-help/150579/5 "2008-10-10T17:46:17Z")

</div>

Nate T. wrote:

> If anybody could give me some pointers on this, I promise that I will do my  
> best to write up some documentation on the summer reboot site about how this  
> extension works. In fact, I will also document my experience with the  
> subscriber\_list (based on newsletter) and database\_form extensions as well.  
> Adding the seemingly simple “sign the guestbook” type of functionality to a  
> Radiant site is a deceptively complex task and I will do my part to try and  
> reduce the pain in the process.

Oops… seems my reply to Bill went off to the wrong person! 🙂

Cheers,  
Mohit.  
10/10/2008 | 11:44 PM.
