assignable_values now lets you define a secondary default that is only used if the primary default value is not...

You can use String#demodulize from ActiveSupport: "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections" "Inflections".demodulize # => "Inflections"

When you develop a gem and you have a Gemfile in your project directory, you might be surprised that your...

makandra dev

...Ruby object can now be a power: class Power ... power :api_key do 'secret-123' if admin? end end Power.current.api_key # => 'secret-123' for admins Power.current.api_key? # => true for admins...

makandra dev

The usage shares of your site highly depends on your target audience. E.g. no Internet Explorer has ever seen hollyapp.com...

Don't say is_a?(ActiveRecord::NamedScope::Scope) because that is no longer true in Rails 3 and also doesn...

github.com

paper_trail is an excellent gem to track record versions and changes. You almost never want to reimplement something like...

makandracards.com

When we looked at this card together a year ago, we were no longer sure if unquote is actually useful...

github.com

You've always been able to access the humanized version for the current value like this: song = Song.new(:genre => 'pop...

The will_paginate gem will show a default of 30 records per page. If you want to test pagination in...

Unless you changed the default, this will be 16 MB: mysql> SHOW VARIABLES WHERE Variable_name="max_allowed_packet"; +--------------------+----------+

makandra dev
martinfowler.com

Rake (like make) allows you to add dependencies to a task after you've initially declared it. Indeed it allows...

...you probably have a time zone issue. When you get Timecop.travel(Date.parse("2011-11-11 00:00") do Time.current # Thu, 10 Nov 2011 23:00:01 UTC +00:00

makandra dev
dev.mysql.com

Take care in queries where multiple AND or OR operators are used. In doubt, always use braces to enforce precedence...

makandra dev
github.com

The asset pipeline from Rails 3.1 packported to 2.3. By Michael Grosser from parallel_tests fame.

The facebook API allows up to 600 requests per 600 seconds. If you poll more often, you'll get no...

makandra dev
build.phonegap.com

Write your app using HTML, CSS or JavaScript, upload it to the PhoneGap Build service and get back app-store...

When deploying, Capistrano puts a REVISION file into your application's release directory. It contains the hash of the commit...

For my Gem Session project Holly I ran the Ironman of drag'n'drop implementations: Dragging in nested lists

You can say this in helpers like link_to and content_tag: = link_to 'Label', root_url, :data => { :foo => 'bar...

This will make MySQL log all received queries so you can see for yourself what happens on the database level...

api.jquery.com

The $.cssHooks object provides a way to define functions for getting and setting particular CSS values. It can also be...

makandracards.com

The step we used in the past (Then "foo" should not be visibile) doesn't reliably work in Selenium features...