3 Railsex - pronounced "Rails Extensions" OR "Ex Rails" ( easier to say ) - is a plugin for all those cool/good to have/experimental features
4 which cannot possibly be in core due to their nature. As rails itself, this plugin is supposed to be a community effort. So, do chime in !
10 $ sudo gem install railsex
11 $ gem unpack railsex vendor/plugins
15 $ git clone git://repo.or.cz/railsex.git vendor/plugins
19 Railsex loads extensions only on demand because of the variety of options it provides.
21 You will need to load the extension in your environment.rb configuration block with following syntax :
23 config.after_initialize do
24 config.extensions = [:respond_to, :lazy_attributes, :console]
27 The plugin requires Rails 2.0.x or higher version.
37 == Argument-less support for respond_to :
39 In your controller you can have :
43 xml { render :xml => @article }
46 == Lazy attributes to provide partial updates
48 You can declare lazy attributes in your model definition :
50 class Person < ActiveRecord::Base
51 lazy_attributes :history, :bio
54 In this case, when you do @person.save, ActiveRecord will include bio and history columns in UPDATE query only if you accessed
55 @person.history= or @person.bio= methods.
57 == Very common console tricks
59 * [] finders for model so you can do Article[1], Article[:all]
60 * "log_to" function to print out db queries to rails irb console
64 Pratik Naik - http://m.onkey.org
66 Unknown people from the internet for "console" extension