mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-19 08:40:12 +01:00
19 lines
626 B
Ruby
19 lines
626 B
Ruby
|
|
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 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"
|
||
|
|
else
|
||
|
|
""
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|