Sunday, July 31, 2011

enumerated_attribute

Easily code enumerations for your models and expose them as drop-down lists with the enum_select helper, or use any of enumerated_attribute features to simplify coding enumerations in any Ruby object.

Typically, in Ruby, enumerated attributes are implemented with strings, symbols or constants. Often the developer is burdened with repeatedly defining common methods in support of each attribute. enumerated_attribute provides a DRY implementation for enumerations in Rails. Repetitive code such as initializers, accessors, predicate and enumeration methods are automatically generated along with the following features:
  • ActiveRecord integration
  • ActionView form helpers
  • Scaffold generator integration
  • Definable enumeration labels
  • Enum helper methods
  • Dynamic predicate methods
  • Initialization
  • State pattern support (enumerated_state)
https://github.com/jeffp/enumerated_attribute

Mac OSX Lion and RMagick

Error after update:
...
/Users/xxx/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/rmagick.rb:11:in `require': dlopen(/Users/xxx/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib (LoadError)
...
Solution:
Recompile all your gems: gem pristine --all
dydl errors are commonly associated with database drivers/bindings

Tuesday, July 26, 2011

Chosen

Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.

https://github.com/harvesthq/chosen/
http://harvesthq.github.com/chosen/ 

Monday, July 25, 2011

CUPS on Mac OSX

CUPS is the standards-based, open source printing system developed by Apple Inc. for Mac OS® X and other UNIX®-like operating systems.

http://localhost:631/

Tuesday, July 19, 2011

Rails 3.1 (rc4) app on ruby 1.9.2p290 (2011-07-09 revision 32553) (RVM)

rake aborted! stack level too deep
The solution, prefix calls to rake with bundle exec
bundle exec rake ...

Sunday, July 10, 2011

turn

TURN is a new way to view Test::Unit results.
With longer running tests, it can be very frustrating to see a failure (....F...) and then have to wait till all the tests finish before you can see what the exact failure was.

TURN displays each test on a separate line with failures being displayed immediately instead of at the end of the tests.
If you have the 'ansi' gem installed, then TURN output will be displayed in wonderful technicolor (but only if your terminal supports ANSI color codes).
Well, the only colors are green and red, but that is still color.

http://rubygems.org/gems/turn