What's new? | Help | Directory | Sign in
Google
                
Blogs:
Join project
Project owners:
  cainlevy

Sometimes it's handy for one of your ActiveRecord classes to proxy methods from another associated class. This can be useful for simplifying forms, for example.

Once you've installed the ActsAsProxy plugin you can do something like the following:

class User < ActiveRecord::Base
  has_one :address
  proxies :address, :city, :state, :zip
end

u = User.new
u.address_city = 'Schenectady'
u.address_state = 'New York'
u.address_zip = 12345

u.address_city == u.address.city