{"action":"opened","issue":{"url":"https://api.github.com/repos/tgriesser/bookshelf/issues/648","labels_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/648/labels{/name}","comments_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/648/comments","events_url":"https://api.github.com/repos/tgriesser/bookshelf/issues/648/events","html_url":"https://github.com/tgriesser/bookshelf/issues/648","id":60338650,"number":648,"title":"How to use `attach()` while specifying pivot table fields?","user":{"login":"gfarrell","id":314331,"avatar_url":"https://avatars.githubusercontent.com/u/314331?v=3","gravatar_id":"","url":"https://api.github.com/users/gfarrell","html_url":"https://github.com/gfarrell","followers_url":"https://api.github.com/users/gfarrell/followers","following_url":"https://api.github.com/users/gfarrell/following{/other_user}","gists_url":"https://api.github.com/users/gfarrell/gists{/gist_id}","starred_url":"https://api.github.com/users/gfarrell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfarrell/subscriptions","organizations_url":"https://api.github.com/users/gfarrell/orgs","repos_url":"https://api.github.com/users/gfarrell/repos","events_url":"https://api.github.com/users/gfarrell/events{/privacy}","received_events_url":"https://api.github.com/users/gfarrell/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-09T12:53:02Z","updated_at":"2015-03-09T12:53:02Z","closed_at":null,"body":"I want to attach one of `ModelA` to `ModelB` (belongsToMany relation). The pivot table has columns `role`, `created_at` and `updated_at`.\r\n\r\nFrom what I can see, `relation.attach()` doesn't allow me to specify, and it seems silly to hit the database with more than one request to add a row into the pivot table, then to specify fields on that pivot table.\r\n\r\nIs there a way to do this?"}}