Sha256: 78ec64715974b990c0c0024077a2a1c52803932ec3eaaeb60077e090bd4573a6

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

require 'active_record'
require 'acts_as_array'

# create_table :users do |t|
#   t.string :name
# end
# create_table :mails do |t|
#   t.string :name
#   t.references :user
# end
# create_table :phones do |t|
#   t.string :name
#   t.references :user
# end

class Mail < ActiveRecord::Base
  belongs_to :user
end

class Phone < ActiveRecord::Base
  belongs_to :user
end

class User < ActiveRecord::Base
  include ActsAsArray
  has_many :mails
  has_many :phones
  acts_as_array :mails => {:class => Mail, :field => :name},
    :phones => {:class => Phone, :field => :name}
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_array-0.0.1 spec/model.rb