Sha256: 69b102f269706618ca147cabeccfd94adb64b8cfbc986d3dbd9c3bbabdbc1c24
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
require 'rails' module Resty module TimeFormat def as_json(options = nil) strftime('%Y-%m-%dT%H:%M:%S.') + ("%06d" % usec) + strftime('%z') end def as_html(options = nil) strftime('%Y-%m-%d %H:%M:%S.') + ("%06d" % usec) end end class RestyRailtie < Rails::Railtie config.generators do require 'rails/generators' require 'rails/generators/rails/controller/controller_generator' #require 'rails/generators/erb/scaffold/scaffold_generator' Rails::Generators::ControllerGenerator.hook_for :resty, :type => :boolean, :default => true do |controller| invoke controller, [ class_name, actions ] end end config.after_initialize do ActiveRecord::Base.include_root_in_json = false # TODO there migt be a way to tell ALL ActiveModel: #ActiveModel::Base.include_root_in_json = false # get the time/date format right ;-) and match it with resty class DateTime include TimeFormat end class ActiveSupport::TimeWithZone include TimeFormat end class Date include TimeFormat end class Time include TimeFormat end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
resty-generators-0.3.2 | lib/resty/resty_railtie.rb |
resty-generators-0.3.1 | lib/resty/resty_railtie.rb |