Forum: Radiant CMS Re: Need a little more newsletter_extension help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nate Turnage (Guest)
on 2008-10-10 06:06
(Received via mailing list)
On Thu, Oct 9, 2008 at 9:38 PM, Nate Turnage <pixelnate@gmail.com>
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
Andrew Neil (Guest)
on 2008-10-10 10:26
(Received via mailing list)
On Fri, Oct 10, 2008 at 5:06 AM, Nate Turnage <pixelnate@gmail.com>
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


http://github.com/pilu/radiant-newsletter/tree/mas...

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:


http://github.com/pilu/radiant-newsletter/tree/mas...

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...

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
Bill Barnard (Guest)
on 2008-10-10 17:12
(Received via mailing list)
On Fri, Oct 10, 2008 at 09:26:26AM +0100, Andrew Neil 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
Mohit Sindhwani (Guest)
on 2008-10-10 17:44
(Received via mailing list)
Hi Bill,

Bill Barnard 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

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

Thanks
Mohit.
Mohit Sindhwani (Guest)
on 2008-10-10 17:46
(Received via mailing list)
Nate Turnage 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.
This topic is locked and can not be replied to.