Sha256: 4ebdd66c2c599e7d279115194cd20d70cb9bf441834c62e9e15144e17197d932
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
require 'rails' module Resty 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 def as_json(options = nil) strftime('%Y-%m-%dT%H:%M:%S.') + ("%06d" % usec) + strftime('%z') end end class ActiveSupport::TimeWithZone def as_json(options = nil) strftime('%Y-%m-%dT%H:%M:%S.') + ("%06d" % usec) + strftime('%z') end end class Time def as_json(options = nil) strftime('%Y-%m-%dT%H:%M:%S.') + ("%06d" % usec) + strftime('%z') end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
resty-generators-0.3.3 | lib/resty/resty_railtie.rb |