Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

Method new on collection does not work #4

Open
loicboutet opened this issue Sep 8, 2016 · 0 comments
Open

Method new on collection does not work #4

loicboutet opened this issue Sep 8, 2016 · 0 comments

Comments

@loicboutet
Copy link

Example :
You have a Post model which has many Comment.

You cannot do in reactive-record
post.comments.new(title: "hello world")
So you have to do
post.comments << Comment.new(title: "hello world")

This patch seem to fix the problem :

module ReactiveRecord
  class Collection
    def new(*args)
      self << klass.new(*args)
    end
  end
end
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant