Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/decent_exposure/behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def scope(model)
#
# Returns a standard Class name.
def model
name.to_s.classify.constantize
[model_namespace, name.to_s.classify].compact.join('::').constantize
end

# Public: Find an object on the supplied scope.
Expand Down Expand Up @@ -84,6 +84,10 @@ def build_params
end

protected
def model_namespace
options[:model_namespace].to_s
end


def params_id_key_candidates
["#{model_param_key}_id", "#{name}_id", "id"].uniq
Expand Down
7 changes: 7 additions & 0 deletions lib/decent_exposure/exposure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def normalize_options
normalize_parent_option
normalize_from_option
normalize_find_by_option
normalize_model_namespace_option
end

def normalize_fetch_option
Expand Down Expand Up @@ -138,6 +139,12 @@ def normalize_model_option
end
end

def normalize_model_namespace_option
normalize_non_proc_option :model_namespace do |value|
-> { value.to_s }
end
end

def normalize_build_params_option
normalize_non_proc_option :build_params do |value|
options[:build_params_method] = value
Expand Down
2 changes: 1 addition & 1 deletion lib/decent_exposure/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module DecentExposure
VERSION = "3.0.4"
VERSION = "3.0.5"
end