Sha256: 4df76527a4e63748d6f436297e8c70fe970a2dda4314f1c9e3f8d462014e3b29

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
datamapper4rail-0.1.0 generators/rspec_default_values.rb
datamapper4rail-0.2.0 generators/rspec_default_values.rb