How to insert more Disqus comments box in a single page

Hello everyone! For those not familiar Disqus is a platform that allows you to easily insert a box for comments on any website and allows users to use the their Facebook or Twitter account (but not only) to authenticate. The limit of Disqus is that it associates any thread of comments to a unique url. Consequently, it will expect that...

Read more

How to send email asynchronously using Devise and Rails3

Hello everyone.I’d show a workaround to send email asynchronously using Devise and Rails3.Suppose we have already up and running our application with Devise and delayed_job correctly installed.A first attempt was to add in config/initializers the following file (devise_async.rb):12345678910111213141516#devise_async.rb module Devise module Models module Confirmable handle_asynchronously :send_confirmation_instructions end module Recover...

Read more
Ruby on Rails and jQuery: multiselect with checkbox

Ruby on Rails and jQuery: multiselect with checkbox

Today I want to present a very convenient jQuery plugin I’ve used to create a combo box with checkboxes for a multi-selection field.Suppose we have a form of insertion / modification of user data, and that the user can have multiple functions. We start with rendering the form with a multi-selection field, where you can select more functions with the combination “<ctrl> + click “.123456789101112<%= simp...

Read more

How-to send email with a Google account form Ruby On Rails

I have seen many articles in the web that explain how to send an email with a Google account from a Ruby On Rails application. However, I believe there are several faulty or incomplete examples around. That’s why I decided to share a working solution that I used in various projects.The main problem with Gmail (or with an address linked to Google Apps) is that prompts for an SSL connection. As often happens with Ruby On Rails, the solution is quite simple. You j...

Read more

Different layout for the same controller

In some projects can happen that you have to use different graphic templates for different methods of the same controller. At first sight one would implement a solution that provides an explicit call to the desired layout within each action.Something like this:123456789101112131415161718192021class PostController < ApplicationController def index [....

Read more

Rails Best Practices 6: Filters and helpers file

With the today’s post I shall conclude my series on Ruby On Rails Best Practices . This is not because the required topics are completed, but rather because after the release of Rails 3.0, some constructs have been changed and should be reviewed. Probably in future we will return to talk about best practices, but starting from the new features introduced in the current Rails version. But now I will describe two techniques that are valid and which are mainly...

Read more