Hi, I need to write some models localized in four languages ending up in 
writing something like this:

  property :title_en, String, :length => (1..128), :format => /[\w+\s*]*/u
  property :title_es, String, :length => (1..128), :format => /[\w+\s*]*/u
  property :title_it, String, :length => (1..128), :format => /[\w+\s*]*/u
  property :title_fr, String, :length => (1..128), :format => /[\w+\s*]*/u

  def title
    attribute_get "title_#{I18n.locale}"
  end

so I begun thinking about writing a simple is plugin to dynamically add and 
remove properties on runtime.
Adding properties on runtime is not a problem after studying pickaxe and other 
is plugins and dm source code

Now I would like to end up with something like 

class Page
  include DataMapper::Resource
                                                                        
  property :id, Integer
  property :title, String, :length => (1..128), :format => /[\w+\s*]*/u
  property :text, Text, :length => (64..1024)
                                                                        
  is :multilingual, :on => [:title, :text], :as => [:en, :es, :it, :fr]
end

my problem right now is just remove the property to be localized end rename it 
as title_/(en|es|it|fr)/ maintaining it's type and options

bye

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to