Ruby, Rails, Firefox, Anime, Mac
This week’s report covers changes from 10 Mar 2008 to 16 Mar 2008 (the day the corresponding Rails Envy podcast was recorded).
Remember how you can do something like:
You can now register your own custom expansion symbol too:
would result in:
You can do the same with the
Warning: This patch currently breaks the default symbols like
:all (check out the ticket for more info).
Related changeset: http://dev.rubyonrails.org/changeset/9016
Remember how you can say
timestamps in a migration and Rails will create the ‘created_at’ and ‘updated_at’ columns for you? You can now also do
add_timestamps :table_name and
remove_timestamps :table_name in your migrations if you decide to add these columns later to a table:
def self.up add_timestamps :posts end def self.down remove_timestamps :posts end
Related changeset: http://dev.rubyonrails.org/changeset/9014
Comment.find(:first), you can now do something like
Comment.find(:last). There’s some controversy over whether this is bloat, but DHH makes a good case for it with this example:
class Person has_many :comments, :order => 'created_at' end @some_person.comments.find(:last) # => Returns the most recent comment.
Related changeset: http://dev.rubyonrails.org/changeset/9012
rake db:create used to ignore the ‘charset’ and ‘collation’ options in your database.yml configuration file. This has been fixed so that your created databases now respect those options.
rake db:drop and
rake db:migrate:reset also no longer crash with an unhelpful exception if the database has already been dropped, and instead shows a proper error message.
Related changeset: http://dev.rubyonrails.org/changeset/9004
This is a blessing to those of us who use version control systems that don’t support empty directories (like Git). Rails’ default logger (the BufferedLogger), now creates a log/ directory if it doesn’t already exist. This should save you the step of creating/symlinking a log/ directory (or symlinking) on deploy.
Related changeset: http://dev.rubyonrails.org/changeset/9013
A faster implementation of the
String#squish!) core extension has been committed.
Related changeset: http://dev.rubyonrails.org/changeset/9015
Turns out that the
#excerpt helper method was consistently including an extra character. This has been fixed.
Related changeset: http://dev.rubyonrails.org/changeset/9030
As usual, let me know of any inaccuracies or any suggestions you may have in the comments!