Skip to content

Commit

Permalink
Merge commit 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlarsen committed Dec 1, 2009
2 parents b1e9231 + 572c7c1 commit f647cc9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hobo/CHANGES.txt
Expand Up @@ -90,6 +90,9 @@ Major enhancements:
the "decorated join table" functionality that was deprecated in Rails 2.3
is NOT supported.

- [#475](https://hobo.lighthouseapp.com/projects/8324-hobo/tickets/475)
User-defined rich types are now loaded from RAILS_ROOT/app/rich_types, if it exists.

- EnumString's can now be translated. The
[manual](http://cookbook.hobocentral.net/manual/hobofields/rich_types)
has been updated with the details.
Expand Down
9 changes: 9 additions & 0 deletions hobofields/lib/hobo_fields.rb
Expand Up @@ -100,6 +100,15 @@ def enable
# Add the fields do declaration to ActiveRecord::Base
ActiveRecord::Base.send(:include, HoboFields::FieldsDeclaration)

# automatically load other rich types from app/rich_types/*.rb
# don't assume we're in a Rails app
if defined?(::Rails)
Dir[File.join(::Rails.root, 'app', 'rich_types', '*.rb')].each do |f|
# TODO: should we complain if field_types doesn't get a new value? Might be useful to warn people if they're missing a register_type
require f
end
end

# Monkey patch ActiveRecord so that the attribute read & write methods
# automatically wrap richly-typed fields.
ActiveRecord::AttributeMethods::ClassMethods.class_eval do
Expand Down

0 comments on commit f647cc9

Please sign in to comment.