Tag Archives: jquery

handling ajax callbacks in rails3 using jquery

Previously, in rails 2.3.8 i used the prototype-helpers link_to_remote and form_remote_for (amongst others).
These had the option to add callbacks as follows:

link_to_remote "Add to cart",
:url => { :action => "add", :id => product.id },
:update => { :success => "cart", [...]

rails 3 and haml and unobtrusive javascript

I have created a Rails3 application, started with Haml/Sass and finding it awesome. I am also trying to do unobtrusive javascript.
Before, in Rails 2.3, I would have expected a remote-form to have an :update attribute, where you could specify a selector where the response of the remote method would be rendered.
Now it needs to be [...]

starting a new rails3 site using rspec2 and jquery

With Rails3 i can create a project fully cut to my needs. I will write it down here, just so i remember it well and hopefully it will help some of you too.
In my projects, i want to use haml, rspec2, factory-girl, jquery, …
We need a few steps to complete this.
Create the project
For starters, create [...]

using content_for jquery on document ready

In my Rails application i use a generic application.rhtml for all my pages. Amongst others, this code contains some jQuery code to manipulate my page

var $j = jQuery.noConflict()

$j(document).ready(function() {

// remove all alt-tags
$j("[alt]").removeAttr("alt");

[...]

jquery validation only one field in a group required

I am using the jQuery validate plugin which is awesome for straightforward form validation. What i especially like is that it offers the user a better user experience, because there is no need for the round-trip to the server.
I still need to do the validation on the server-side (rails) as well. I guess there should [...]