ror

Ruby on Rails with JQuery

Ruby on Rails comes by default with the Prototype and Script.aculo.us Javascript Frameworks enabled to be used in AJAX calls and visual effects.

Rails Tricks

Do you know what the command below would do?

post.select(&:activated?).collect(&:title)


Do you want to get maximums, minimums, averages, or sums for data in your tables? Did you know ActiveRecord has a .to_xml() method?

Rails 2.2.2 and MySQL 5.X in Windows issue - cannot migrate

Just formatted my machine and had to reinstall all my development environment in Windows 7. I ran into a problem that I never had before. After successfully installing MySQL 5.1, Ruby 1.8.6 and Rails 2.2.2 (I need those in these exact versions, because this is what my hosting service supports) I tried to migrate my database and the problems began.
After running "rake db:migrate" I got this error message:

!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!

Migrate Rails Database

To migrate your database in production environment simply run the following command.

rake db:migrate RAILS_ENV=production

Rails 2.3.5 and MySQL with Netbeans and WEBrick in Windows

After upgrading from Rails 2.0.2 to 2.3.5 my WEBrick server in NetBeans started printing the following message on its log and the application would not connect to the database.

The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.

I installed the refered gem but would still have the same problem when starting WEBrick, even after restart of the IDE.

Undefined method cache_template_extensions when migrating to Rails 2.3.5

After upgrading from Rails 2.0.2 to Rails 2.3.5 I got the following error message on startup of the server:

`send': undefined method `cache_template_extensions=' for ActionView::Base:Class (NoMethodError)

The solution is as simple as removing (or commenting out) the property 'cache_template_extensions' from 'configuration/environments/development.rb' as it no longer exists in rails 2.3.5.

NetBeans 6 Ruby fast debugger and Windows

If you are using Netbeans as a development environment for creating Ruby on Rails software, you should know how to debug your application. Using these out-of-the-box frameworks are really great when it comes to the speed of the development however, whenever you face strange behavior, debugging is the key.

Tip: Rails Debug Helper in a Popup

I found this nice article which proposes a ready-to-use debug popup window. All you have to do is add a simple command at the end of your application layout and a popup will show all the information regarding the request, session, response, flash variables and more.

Quick way to debug your web application.

Cheers!

Call link_to_remote from inside the Controller in Rails

I wrote an article the other day stating that I had no idea why someone would call a Helper method from inside a Controller in Rails.
I just found a reason. Here is what I needed to do:

HOW-TO Call a Helper Method inside the Controller in Rails

Rails relies on the MVC separation to do its job, i.e. the Model handles the database interaction, the View handles the user and front-end interaction and the Controller handles the business logic and flow of the information.

Syndicate content