Sha256: dd7b9cafa214bbdc85867b6660455914de6a60ca9e95c3e0096661c5635f6e01

Contents?: true

Size: 1.46 KB

Versions: 2

Compression:

Stored size: 1.46 KB

Contents

# A set of models and associations we can use in our specs to test
# basic database columns and also relationships

# See Companion migration spec/db/migrate for latest def

#     create_table :projects do |t|
#       t.string   :title
#       t.string   :value_as_string
#       t.text     :value_as_text
#       t.boolean  :value_as_boolean, :default => false
#       t.datetime :value_as_datetime, :default => nil
#       t.integer  :value_as_integer, :default => 0
#
#       :precision - Specifies the precision for a :decimal column.
#       :scale - Specifies the scale for a :decimal column.
#
#       For example, the number 123.45 has a precision of 5 and a scale of 2.
#       A decimal with a precision of 5 and a scale of 2 can range from -999.99 to 999.99.
#
#       t.decimal  :value_as_double, :precision => 8, :scale => 4, :default => 0.0
#
#       t.references :user
#       t.timestamps
#     end

class Project < ActiveRecord::Base

  belongs_to :user

  has_one :owner

  has_many :milestones

  has_many :loader_releases
  has_many :versions, through: :loader_releases

  # has_many :release_versions, :through => :loader_releases, :source => :versions

  has_and_belongs_to_many :categories

  # Rails 4 move to Controller
  # attr_accessible  :value_as_string, :value_as_boolean, :value_as_double

  def multiply
    10 * value_as_double
  end

  def a_custom_user_id_setter( value )
    self.user_id = 123456789
  end

end

module DataShift
  class AClassInAModule
  end
end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
datashift-0.40.1 spec/dummy/app/models/project.rb
datashift-0.40.1 spec/fixtures/models/project.rb