Forum: Ruby on Rails to ajax or not to ajax

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.
Alan B. (Guest)
on 2006-04-25 18:26
(Received via mailing list)
before I started building my latest rails app, I made the decision to
make
good use of ajax. My reasonsing was that users would benefit from the
quicker page updates - the application provides various different types
of
insurance quotes, and has several multi-page forms and reports that can
be
drilled down 5 or 6 levels deep in some cases - so it seemed like a good
candidate for ajax

Now that I've started writing the thing, I'm wondering if I've made a
mistake. I find ajax to be difficult to test and debug, and my views
consist
pretty much entirely of partials - it's getting hard to keep track of
them
all.

I'm just wondering how other developers decide if it's worth going down
the
ajax route.
Marco L. (Guest)
on 2006-04-25 18:38
(Received via mailing list)
Hi Alan,

sure, I'm having problem too with my first applications using AJAX but
I think it's a matter of time and experience. In the meanwhile, have a
look at the snippet of code Richard W. (of AJAX scaffold generator
fame) suggests for debugging:

http://www.height1percent.com/articles/2006/04/21/...

Cheers,
Marco
Peter De Berdt (Guest)
on 2006-04-25 18:54
(Received via mailing list)
On 25 Apr 2006, at 16:22, Alan B. wrote:

>
> Now that I've started writing the thing, I'm wondering if I've made a
> mistake. I find ajax to be difficult to test and debug, and my
> views consist
> pretty much entirely of partials - it's getting hard to keep track
> of them
> all.
>
> I'm just wondering how other developers decide if it's worth going
> down the
> ajax route.

There are two things to help you: there's a function somewhere to
turn AJAX debugging on and you should use firefox with the Firebug
extension, it will allow you to debug javascript.

Best regards

Peter De Berdt
Peter (Guest)
on 2006-04-25 19:22
Some paper to sketch my form and naming of DIV's helps.

But with RJS its pretty simple.

Love it. And now in the controllers.

That saves a lot of rjs templates
Alex W. (Guest)
on 2006-04-25 20:30
Peter De Berdt wrote:
> On 25 Apr 2006, at 16:22, Alan B. wrote:
>
>>
>> Now that I've started writing the thing, I'm wondering if I've made a
>> mistake. I find ajax to be difficult to test and debug, and my
>> views consist
>> pretty much entirely of partials - it's getting hard to keep track
>> of them
>> all.
>>
>> I'm just wondering how other developers decide if it's worth going
>> down the
>> ajax route.
>
> There are two things to help you: there's a function somewhere to
> turn AJAX debugging on and you should use firefox with the Firebug
> extension, it will allow you to debug javascript.
>
> Best regards
>
> Peter De Berdt

Definately Firebug.  It absolutely rocks.  You can see every ajax
request, and its response, as well as inspect the DOM and has great
javascript error ctaching and debugging.

Also set this in your config/environments/development.rb

# RJS Error reporting
config.action_view.debug_rjs = true

And any ajax request that generates an error will do an "alert(...info
about error...);" so you get immedaite feedback about what went wrong.

And check out the presenatation slides here:
http://mir.aculo.us/articles/2006/04/15/slides-fro...
They taught me everything I just told you.
Peter De Berdt (Guest)
on 2006-04-25 20:48
(Received via mailing list)
On 25 Apr 2006, at 18:30, Alex W. wrote:

>>> all.
>>
>
> And any ajax request that generates an error will do an "alert(...info
> about error...);" so you get immedaite feedback about what went wrong.
>
> And check out the presenatation slides here:
> http://mir.aculo.us/articles/2006/04/15/slides-fro...
> presentation-at-canada-on-rails
> They taught me everything I just told you.

That's what I was trying to say, but being to lazy to type and look
it up, thanks for filling that in ;-)

Best regards

Peter De Berdt
This topic is locked and can not be replied to.