Module: Hammock
- Defined in:
- lib/hammock.rb,
lib/hammock/mutex.rb,
lib/hammock/scope.rb,
lib/hammock/utils.rb,
lib/hammock/logging.rb,
lib/hammock/suggest.rb,
lib/hammock/callback.rb,
lib/hammock/ajaxinate.rb,
lib/hammock/callbacks.rb,
lib/hammock/constants.rb,
lib/hammock/overrides.rb,
lib/hammock/route_for.rb,
lib/hammock/hamlink_to.rb,
lib/hammock/route_node.rb,
lib/hammock/route_step.rb,
lib/hammock/export_scope.rb,
lib/hammock/lambda_alias.rb,
lib/hammock/canned_scopes.rb,
lib/hammock/model_logging.rb,
lib/hammock/restful_actions.rb,
lib/hammock/restful_support.rb,
lib/hammock/model_attributes.rb,
lib/hammock/javascript_buffer.rb,
lib/hammock/restful_rendering.rb,
lib/hammock/lambda_composition.rb,
lib/hammock/resource_retrieval.rb,
lib/hammock/monkey_patches/hash.rb,
lib/hammock/monkey_patches/time.rb,
lib/hammock/route_drawing_hooks.rb,
lib/hammock/monkey_patches/array.rb,
lib/hammock/controller_attributes.rb,
lib/hammock/monkey_patches/logger.rb,
lib/hammock/monkey_patches/method.rb,
lib/hammock/monkey_patches/module.rb,
lib/hammock/monkey_patches/object.rb,
lib/hammock/monkey_patches/string.rb,
lib/hammock/monkey_patches/numeric.rb,
lib/hammock/resource_mapping_hooks.rb,
lib/hammock/monkey_patches/route_set.rb,
lib/hammock/monkey_patches/action_pack.rb,
lib/hammock/monkey_patches/active_record.rb
Defined Under Namespace
Modules: ActionControllerPatches, ActiveRecordPatches, Ajaxinate, ArrayPatches, BufferedLoggerPatches, Callbacks, CannedScopes, Constants, ControllerAttributes, ExportScope, HamlinkTo, HashPatches, JavascriptBuffer, LambdaAlias, LambdaComposition, Logging, MethodPatches, ModelAttributes, ModelLogging, ModulePatches, Mutex, NumericPatches, ObjectPatches, Overrides, ResourceMappingHooks, ResourceRetrieval, RestfulActions, RestfulRendering, RestfulSupport, RouteDrawingHooks, RouteFor, RouteSetPatches, Scope, StringPatches, Suggest, TimePatches, Utils Classes: Callback, RouteNode, RouteStep
Constant Summary collapse
- VERSION =
'0.6.0'
- IncludeTarget =
ActionController::Base
- PleaseFileABug =
"Ack, that shouldn't have happened. Please email the full stacktrace to <[email protected]>, so the problem you uncovered can be addressed. Thanks!"
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
-
.load_models ⇒ Object
Trigger a load of every model by trying to access the class we expect in each file within app/models.
- .loaded_from_gem? ⇒ Boolean
Class Method Details
.included(base) ⇒ Object
:nodoc:
7 8 9 10 |
# File 'lib/hammock.rb', line 7 def self.included base # :nodoc: puts "Loading Hammock #{Hammock::VERSION} from #{loaded_from_gem? ? 'gem' : 'plugin'}" load_hammock_components end |
.load_models ⇒ Object
Trigger a load of every model by trying to access the class we expect in each file within app/models. This ensures ActiveRecord::Base.subclasses and related methods always return the full set of models they should.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/hammock.rb', line 19 def self.load_models Dir.glob(RAILS_ROOT / 'app/models/**/*.rb').each {|model_file| klass = File.basename(model_file, '.rb').camelize begin Object.const_get klass rescue puts "Couldn't load #{klass} from #{model_file}: #{$!}." end } end |
.loaded_from_gem? ⇒ Boolean
12 13 14 |
# File 'lib/hammock.rb', line 12 def self.loaded_from_gem? File.dirname(__FILE__)[/gems\/hammock-[\d.]+\//] end |