Sha256: e5c751862e684455e475334f2415b7188af9b6e11d673af7f428da4fd03a4cc6

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

# gem dependencies
require 'hobosupport'

# Force load:
HoboFields

# Monkey patches, ooh ooh
require 'rexml'
require 'active_record/has_many_association'
require 'active_record/has_many_through_association'
require 'active_record/association_proxy'
require 'active_record/association_reflection'
require 'action_view_extensions/base'

require 'hobo'
require 'hobo/dryml'

require 'hobo/model'

require 'hobo/dryml/template'
require 'hobo/dryml/taglib'
require 'hobo/dryml/template_environment'
require 'hobo/dryml/template_handler'

require 'extensions/test_case' if RAILS_ENV == "test"


ActionView::Base.register_template_handler("dryml", Hobo::Dryml::TemplateHandler)

class ActionController::Base

  def self.hobo_user_controller(model=nil)
    @model = model
    include Hobo::ModelController
    include Hobo::UserController
  end

  def self.hobo_model_controller(model=nil)
    @model = model
    include Hobo::ModelController
  end

  def self.hobo_controller
    include Hobo::Controller
  end

end

class ActiveRecord::Base
  def self.hobo_model
    include Hobo::Model
    fields # force hobofields to load
  end
  def self.hobo_user_model
    include Hobo::Model
    include Hobo::User
  end
end

# Default settings

Hobo.developer_features = RAILS_ENV.in?(["development", "test"]) if Hobo.developer_features?.nil?


module ::Hobo
  # Empty class to represent the boolean type.
  class Boolean; end
end


if defined? HoboFields
  HoboFields.never_wrap(Hobo::Undefined)
end


# Add support for type metadata to arrays
class ::Array
  
  attr_accessor :member_class, :origin, :origin_attribute
  
  def to_url_path
    base_path = origin_object.try.to_url_path
    "#{base_path}/#{origin_attribute}" unless base_path.blank?
  end
  
  def typed_id
    origin_id = origin.try.typed_id
    "#{origin_id}_#{origin_attribute}" if origin_id
  end
  
end


class NilClass
  def typed_id
    "nil"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hobo-0.7.3 hobo_files/plugin/init.rb