Rails on the Run

Rails experiments by Matt Aimonetti

Browsing Posts tagged update

What’s new?

  • Rails default database is now sqlite3. If you are running Leopard, everything is already setup for you. As DHH mentioned, just “rails -d mysql yourappname” if you want to generate a new app preconfigured for MySQL.
    Sqlite3 is great and if the only reason why you didn’t give it a try is because you have to use CocoaMySQL, then check out sqlitebrowser

  • Other new feature: rake secret to generate a key used to encrypt your session. Really useful task when you’re migrating an app to 2.x

  • To improve performance, some changes were made to the template caching and you have to restart your production server after a template modification.

  • Validates acceptance of still works for non-existent tables . (sorry Josh, I won’t post after 2am, especially when I forget your life changing bug fix ;) )

  • Added option to pass proc to ActionController::Base.asset_host for maximum configurability. Example:

    ActionController::Base.asset_host = Proc.new { |source|
      if source.starts_with?('/images')
  • Finally, I added 2 new rake tasks: db:migrate:redo and db:migrate:reset

    db:migrate:redo rolls back your database and then migrates it up. You can define the STEP constant to specify the amount of steps you want to rollback. This task is very useful in development mode when making a modification to the latest migration(s).
    db:migrate:reset will drop your database, re create it and migrate it up. Only use this task if you really have to and only in development/test environment. Use db:reset in production mode since it uses the schema.rb file and won’t go through the hundreds of migrations you might have.


2.0.2 (December 16th, 2007)

  • Changed the default database from mysql to sqlite3, so now running “rails myapp” will have a config/database.yml that’s setup for SQLite3 (which in OS X Leopard is installed by default, so is the gem, so everything Just Works with no database configuration at all). To get a Rails application preconfigured for MySQL, just run “rails -d mysql myapp” [DHH]

  • Turned on ActionView::Base.cachetemplateloading by default in config/environments/production.rb to prevent file system stat calls for every template loading to see if it changed (this means that you have to restart the application to see template changes in production mode) [DHH]

  • Introduce rake secret to output a crytographically secure secret key for use with cookie sessions #10363 [revans]

  • Fixed that local database creation should consider local #9026 [parcelbrat]

  • Fixed that functional tests generated for scaffolds should use fixture calls instead of hard-coded IDs #10435 [boone]

  • Added db:migrate:redo and db:migrate:reset for rerunning existing migrations #10431, #10432 [matt]

  • RAILSGEMVERSION may be double-quoted also. #10443 [James Cox]

  • Update rails:freeze:gems to work with RubyGems 0.9.5. [Jeremy Kemper]

  • Added deleteviaredirect and putviaredirect to integration testing #10497 [philodespotos]

  • Allow headers['Accept'] to be set by hand when calling xmlhttprequest #10461 [BMorearty]

  • Added OPTIONS to list of default accepted HTTP methods #10449 [holoway]

  • Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 [chuyeow]. Example:

    ActionController::Base.asset_host = Proc.new { |source|
    if source.starts_with?(‘/images’)

  • Fixed that ActionView#fileexists? would be incorrect if @firstrender is set #10569 [dbussink]

  • Added that Array#toparam calls toparam on all it’s elements #10473 [brandon]

  • Ensure asset cache directories are automatically created. #10337 [Josh Peek, Cheah Chu Yeow]

  • render :x ml and :json preserve custom content types. #10388 [jmettraux, Cheah Chu Yeow]

  • Refactor Action View template handlers. #10437, #10455 [Josh Peek]

  • Fix DoubleRenderError message and leave out mention of returning false from filters. Closes #10380 [Frederick Cheung]

  • Clean up some cruft around ActionController::Base#head. Closes #10417 [ssoroka]

  • Ensure optimistic locking handles nil #lock_version values properly. Closes #10510 [rick]

  • Make the Fixtures Test::Unit enhancements more supporting for double-loaded test cases. Closes #10379 [brynary]

  • Fix that validatesacceptanceof still works for non-existent tables (useful for bootstrapping new databases). Closes #10474 [hasmanyjosh]

  • Ensure that the :uniq option for has_many :through associations retains the order. #10463 [remvee]

  • Base.exists? doesn’t rescue exceptions to avoid hiding SQL errors. #10458 [Michael Klishin]

  • Documentation: Active Record exceptions, destroyall and deleteall. #10444, #10447 [Michael Klishin]

I recently bugged Rick Olson so much about attachment_fu that he gave me SVN access to fix few bugs.

Rick being really busy with ActiveReload he didn’t spend too much time maintaining attachment_fu.

On my side of things, I’ve been using attachment_fu on a lot of projects and I’ve been fixing bugs and adding new features.

My first contribution to attachment_fu is a fix for the ImageScience processor.

Attachment_fu is very flexible and let you use your favorite image processor:

Like many rubyists, I like ImageScience for its simplicity and efficiency. However, attachment_fu had few problems when being used with ImageScience.

  • File sizes for thumbnails were not saved correctly in the database. Fixed
  • Thumbnails based on a gif files were not processed properly. So, this was the big problem. FreeImage has issues dealing with resizing gif files because of the gif palette limitation (256 colors). to avoid this problem thumbnails of gif files are converted to png. However the thumbnail content type info in the database was not saved properly. That’s now fixed.
  • Because of the gif bug reported above, any thumbnail link was broken since it was trying to link to the thumbnail version with a gif extension instead of a png one. Fixed

I also fixed a small bug related to S3 storage and the fact that a_fu had issues loading the config file. (Fixed)

I’ll also try be able to add some of the S3 features I’ve been working on. As well as maybe enhancing the validation process.

In the mean time, you might want to read this blog post about better validation with attachment_fu.

If you are heavily using attachment_fu or starting using it and think that a google group would be great idea, please let me know in the comment and I’ll try to convince Technoweenie that we need to set that up :)

Ooohh I almost forgot, if you fixed some bugs you found while using afu, please contact me so we can get afu bug free.

I’m almost ready to update Globalite with 2 major changes:

  • Support for Chinese (Taiwan, Hong Kong and main land China) thanks to Ivan Chang
  • Better support for Active Record error messages in forms (based on contribution from Ivan)

I’m writing more tests and updating the sample app before releasing the updated version. It should be out in the next few days.

[Globalite page @ Google Code](http://code.google.com/p/globalite/