Interesting, similar size app to ours, but they have 11 developers (we're currently on 2... )
http://www.shopify.com/technology/3033502-shopifys-path-to-rails-3
Mike's Rails and Tech Blog
A place for me to try and document some of the interesting or unusual things I come across.
Thursday 1 September 2011
Thursday 9 June 2011
Remove all Rails Gems...
This is a very handy Linux/Git command to clear all gems from your system in development, especially when you are using Bundler and just want to clean stuff up. It uninstalls all versions of all gems and doesn't prompt you about dependencies etc.
gem uninstall 'gem list |cut -d" " -f1' -Iax
Worth noting it will uninstall everything, including bundler gem and ruby-gems, so you might want to output your list to a file, edit the gems you want to keep out of it then run uninstall on that. I find it easier just to re-install the ones I'm missing.
Explained in more detail here:
http://geekystuff.net/2009/01/14/remove-all-ruby-gems/
gem uninstall 'gem list |cut -d" " -f1' -Iax
Worth noting it will uninstall everything, including bundler gem and ruby-gems, so you might want to output your list to a file, edit the gems you want to keep out of it then run uninstall on that. I find it easier just to re-install the ones I'm missing.
Explained in more detail here:
http://geekystuff.net/2009/01/14/remove-all-ruby-gems/
Friday 19 November 2010
Rails for Zombies
A brilliant little Rails Tutorial you can do in your browser. http://railsforzombies.org/
Wednesday 20 October 2010
ActiveRecord validates_presence_of, case sensitivity and Rails 3 validations
The question arose this morning as to whether validates_presence_of in ActiveRecord was case sensitive by default or not. The documentation says it is case insensitive by default on 2.3 stream and case sensitive by default on 3.0 stream, but I dug down into ActiveRecord it looks to me like that's that isn't a change in behaviour, it's actually a fix in the documentation. It was also case sensitive by default in 2.3 stream.
This explains some issues with exceptions being raised from MySql where we had a unique database index on a column, but we were validating with the default "validates_uniqueness_of".
One additional note on this. Making :case_sensitive => false changes the MySql query to
Which will bypass the benefit of a database index on write. You'll still get the benefits of the index on read operations.
There is quite a lot of discussion around this issue in this lighthouse case. It's not a simple issue.
There are some patches to move around this issue for 2.3 involve detecting the database exceptions on index exceptions, foreign key exceptions and adding them into ActiveRecord errors. Which is a much nicer approach I think. Can see them here and here.
In Rails 3 the validations issue should be much simpler. The new validations code is so much more readable. And custom validation classes look really useful.
http://lindsaar.net/2010/1/31/validates_rails_3_awesome_is_true
activerecord-2.3.5/lib/active_record/validations.rb 774 def validates_uniqueness_of(*attr_names) 775 configuration = { :case_sensitive => true }
This explains some issues with exceptions being raised from MySql where we had a unique database index on a column, but we were validating with the default "validates_uniqueness_of".
One additional note on this. Making :case_sensitive => false changes the MySql query to
WHERE LOWER(table_name.column_name) = BINARY 'value'
Which will bypass the benefit of a database index on write. You'll still get the benefits of the index on read operations.
There is quite a lot of discussion around this issue in this lighthouse case. It's not a simple issue.
There are some patches to move around this issue for 2.3 involve detecting the database exceptions on index exceptions, foreign key exceptions and adding them into ActiveRecord errors. Which is a much nicer approach I think. Can see them here and here.
In Rails 3 the validations issue should be much simpler. The new validations code is so much more readable. And custom validation classes look really useful.
http://lindsaar.net/2010/1/31/validates_rails_3_awesome_is_true
Tuesday 19 October 2010
IE9 with CSS3 doesn't look promising
I suppose it's not entirely surprising but this comparison of CSS 3 on Safari, Chrome and IE9 Beta 4 really is a disappointment.
http://css3wizardry.com/2010/08/14/ie9-is-the-ie6-of-css3/
http://css3wizardry.com/2010/08/14/ie9-is-the-ie6-of-css3/
Subscribe to:
Posts (Atom)