Sha256: ceb168353d7fcab6389fc735df446c421c6cdbeabaae7467cdc6733c19826a8e
Contents?: true
Size: 831 Bytes
Versions: 1
Compression:
Stored size: 831 Bytes
Contents
module Rails module Generators class GeneratedAttribute def default_value @default_value ||= case type when :int, :integer then "1" when :float then "1.5" when :decimal then "9.99" when :datetime, :timestamp, :time then "Time.now" when :date then "Date.today" when :string, :text then "\"value for #{@name}\"" when :boolean then "false" when :belongs_to, :references then "1" else "" end end def name_or_reference if ::Rails::VERSION::STRING >= '2.2' reference? ? :"#{name}_id" : name else name end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec_rails3_gen-0.2.0 | lib/generators/rspec/default_values.rb |