Sha256: 8e9473d4ba67cee4b673e78b29b930ae37ea8eb16f906a661da330fdc8c36e55

Contents?: true

Size: 718 Bytes

Versions: 7

Compression:

Stored size: 718 Bytes

Contents

require 'rails_generator/generated_attribute'
require 'active_record'

module Rails
  module Generator
    class GeneratedAttribute
      def default_value
        @default_value ||= case type
          when :int, :integer               then "1"
          when :float                       then "1.5"
          when :decimal, :big_decimal       then "9.99"
          when :date_time, :datetime,
                          :timestamp, :time then "Time.now"
          when :date                        then "Date.today"
          when :string, :text               then "\"value for #{@name}\""
          when :boolean                     then "false"
          else
            ""
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
datamapper4rails-0.5.2 lib/datamapper4rails/rspec_default_values.rb
datamapper4rails-0.5.1 lib/datamapper4rails/rspec_default_values.rb
datamapper4rails-0.5.0 lib/datamapper4rails/rspec_default_values.rb
datamapper4rails-0.4.0 lib/datamapper4rails/rspec_default_values.rb
datamapper4rails-0.3.2 lib/datamapper4rails/rspec_default_values.rb
datamapper4rails-0.3.1 lib/datamapper4rails/rspec_default_values.rb
datamapper4rails-0.3.0 lib/datamapper4rails/rspec_default_values.rb