Module: StrongResources

Defined in:
lib/strong_resources.rb,
lib/strong_resources/version.rb,
lib/strong_resources/configuration.rb,
lib/strong_resources/strong_resource.rb,
lib/strong_resources/controller/mixin.rb

Defined Under Namespace

Modules: Controller Classes: Configuration, StrongResource, UnregisteredParam, UnregisteredResource

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.configObject



33
34
35
# File 'lib/strong_resources.rb', line 33

def self.config
  @config ||= Configuration.new
end

.configure(&blk) ⇒ Object



29
30
31
# File 'lib/strong_resources.rb', line 29

def self.configure(&blk)
  config.instance_eval(&blk)
end

.find(name) ⇒ Object



37
38
39
40
41
# File 'lib/strong_resources.rb', line 37

def self.find(name)
  found = config.strong_resources[name]
  raise UnregisteredResource.new(name) unless found
  found
end

.type_for_param(name) ⇒ Object

Raises:



43
44
45
46
47
# File 'lib/strong_resources.rb', line 43

def self.type_for_param(name)
  found = config.strong_params[name][:type]
  raise UnregisteredParam.new(name) unless found
  found
end