Sha256: 28d7ad7cda757790a6a5f2d7ca63ae64607c8b04e4e88aae5bec977cd4e8b624
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 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.%N%z') end end class ActiveSupport::TimeWithZone def as_json(options = nil) strftime('%Y-%m-%dT%H:%M:%S.%N%z') end end class Date def as_json(options = nil) strftime('%Y-%m-%dT%H:%M:%S.%N%z') end end class Time def as_json(options = nil) strftime('%Y-%m-%dT%H:%M:%S.%N%z') end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
resty-generators-0.3.0 | lib/resty/resty_railtie.rb |