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

Proxy kwargs independently from positional args. Closes #571. #572

Closed
Closed
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
8 changes: 5 additions & 3 deletions lib/dynamoid/associations/single_association.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def setter(object)

associate(object.hash_key)
self.target = object
object.send(target_association).associate(source.hash_key) if target_association
if target_association
object.send(target_association).associate(source.hash_key)
end
object
end

Expand Down Expand Up @@ -68,9 +70,9 @@ def ==(other)
#
# @private
# @since 0.2.0
def method_missing(method, *args)
def method_missing(method, *args, **kwargs)
if target.respond_to?(method)
target.send(method, *args)
target.send(method, *args, **kwargs)
else
super
end
Expand Down
6 changes: 5 additions & 1 deletion spec/app/models/magazine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ class Magazine
has_many :camel_cases
has_one :sponsor

belongs_to :owner, class_name: 'User', inverse_of: :books
belongs_to :owner, class_name: "User", inverse_of: :books

def publish(advertisements:, free_issue: false)
advertisements * (free_issue ? 2 : 1)
end
end
Loading