Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch instead of delete from options hash #453

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions lib/blueprinter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ def self.association(method, options = {}, &block)

current_view << Association.new(
method: method,
name: options.delete(:name) || method,
extractor: options.delete(:extractor) || AssociationExtractor.new,
blueprint: options.delete(:blueprint),
view: options.delete(:view) || :default,
name: options.fetch(:name) { method },
extractor: options.fetch(:extractor) { AssociationExtractor.new },
blueprint: options.fetch(:blueprint),
view: options.fetch(:view, :default),
options: options.merge(block: block)
ryanmccarthypdx marked this conversation as resolved.
Show resolved Hide resolved
)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/blueprinter/helpers/base_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ module SingletonMethods
private

def prepare_for_render(object, options)
view_name = options.delete(:view) || :default
root = options.delete(:root)
meta = options.delete(:meta)
view_name = options.fetch(:view, :default)
root = options[:root]
meta = options[:meta]
validate_root_and_meta!(root, meta)
prepare(object, view_name: view_name, local_options: options, root: root, meta: meta)
ryanmccarthypdx marked this conversation as resolved.
Show resolved Hide resolved
end
Expand Down