Skip to content

Instantly share code, notes, and snippets.

@vijaydev
vijaydev / Rails
Created November 21, 2010 18:41
Rails
Rails 3 no longer auto loads the lib folder. We can make it auto load the lib folder by putting it in config/application.rb like thus: config.autoload_paths += %W(#{config.root}/lib)
All strings are HTML escaped by default in Rails 3. Need to call html_safe on strings which we know are sure to be safe to display the HTML properly.
Reserved words: "config", "process"
Specifying RailsEnv in Apache configuration (vhost/httpd.conf etc) for Passenger 3.0.0 does not work in Rails 3. Changing that to RakeEnv does the trick. This was fixed in Passenger 3.0.1.
To add the default integer primary key to a table which was created with :id => false setting, we can do add_column :table_name, :id, :primary_key
@vijaydev
vijaydev / gist:1472145
Created December 13, 2011 13:35
Rails 3.2.0 Changelogs

The latest release notes is available at http://edgeguides.rubyonrails.org/3_2_release_notes.html

Railties 3.2.0 (unreleased)

  • Speed up development by only reloading classes if dependencies files changed. This can be turned off by setting config.reload_classes_only_on_change to false. José Valim

  • New applications get a flag config.active_record.auto_explain_threshold_in_seconds in the environments configuration files. With a value of 0.5 in development.rb, and commented out in production.rb. No mention in test.rb. fxn

  • Add DebugExceptions middleware which contains features extracted from ShowExceptions middleware José Valim