{"action":"created","comment":{"url":"https://api.github.com/repos/luckyframework/record/pulls/comments/150387952","pull_request_review_id":75936435,"id":150387952,"diff_hunk":"@@ -167,6 +167,18 @@ abstract class LuckyRecord::Form(T)\n     end\n   end\n \n+  def save! : T\n+    if save\n+      record.not_nil!\n+    else\n+      raise LuckyRecord::InvalidFormError.new(\"#{record} has invalid parameters\")","path":"src/lucky_record/form.cr","position":8,"original_position":8,"commit_id":"2af877ca28fc2faff84e9088cb8d854f8907abf7","original_commit_id":"2af877ca28fc2faff84e9088cb8d854f8907abf7","user":{"login":"paulcsmith","id":22394,"avatar_url":"https://avatars0.githubusercontent.com/u/22394?v=4","gravatar_id":"","url":"https://api.github.com/users/paulcsmith","html_url":"https://github.com/paulcsmith","followers_url":"https://api.github.com/users/paulcsmith/followers","following_url":"https://api.github.com/users/paulcsmith/following{/other_user}","gists_url":"https://api.github.com/users/paulcsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/paulcsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulcsmith/subscriptions","organizations_url":"https://api.github.com/users/paulcsmith/orgs","repos_url":"https://api.github.com/users/paulcsmith/repos","events_url":"https://api.github.com/users/paulcsmith/events{/privacy}","received_events_url":"https://api.github.com/users/paulcsmith/received_events","type":"User","site_admin":false},"body":"It would look something like this: https://github.com/luckyframework/record/commit/576cd3a440b6bb5095594e607198f5c0d717433c#diff-0c6732b55ddd3e3a8985f88608914664R32\r\n\r\nAnd yeah I'd add getting for the form_name and form_object. You don't need to specify the type in `getter` if it is specific in the initializer. LMK if you have any other questions though. Happy to help :)","created_at":"2017-11-11T16:57:16Z","updated_at":"2017-11-11T16:57:20Z","html_url":"https://github.com/luckyframework/record/pull/82#discussion_r150387952","pull_request_url":"https://api.github.com/repos/luckyframework/record/pulls/82","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/luckyframework/record/pulls/comments/150387952"},"html":{"href":"https://github.com/luckyframework/record/pull/82#discussion_r150387952"},"pull_request":{"href":"https://api.github.com/repos/luckyframework/record/pulls/82"}},"in_reply_to_id":150384968},"pull_request":{"url":"https://api.github.com/repos/luckyframework/record/pulls/82","id":152009805,"html_url":"https://github.com/luckyframework/record/pull/82","diff_url":"https://github.com/luckyframework/record/pull/82.diff","patch_url":"https://github.com/luckyframework/record/pull/82.patch","issue_url":"https://api.github.com/repos/luckyframework/record/issues/82","number":82,"state":"open","locked":false,"title":"Add `!` versions of save and update","user":{"login":"edwardloveall","id":49549,"avatar_url":"https://avatars1.githubusercontent.com/u/49549?v=4","gravatar_id":"","url":"https://api.github.com/users/edwardloveall","html_url":"https://github.com/edwardloveall","followers_url":"https://api.github.com/users/edwardloveall/followers","following_url":"https://api.github.com/users/edwardloveall/following{/other_user}","gists_url":"https://api.github.com/users/edwardloveall/gists{/gist_id}","starred_url":"https://api.github.com/users/edwardloveall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwardloveall/subscriptions","organizations_url":"https://api.github.com/users/edwardloveall/orgs","repos_url":"https://api.github.com/users/edwardloveall/repos","events_url":"https://api.github.com/users/edwardloveall/events{/privacy}","received_events_url":"https://api.github.com/users/edwardloveall/received_events","type":"User","site_admin":false},"body":"Fixes #66 \r\n\r\nThese methods will work like the normal `save` and `update`, but only take parameters and no block. If it saves successfully, it will return the record, _not_ the form. If it fails, it will raise a LuckyRecord::Exceptions::InvalidForm error.\r\n\r\nI tried to use the existing logic where it made sense, since the goal is for the method to work the same but have some different behavior after the record is saved (or not).\r\n\r\nI took the hierarchy pattern for the error from LuckyWeb's exception module.","created_at":"2017-11-10T21:48:13Z","updated_at":"2017-11-11T16:57:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"01bc9f1a88c79361926297ec477997b69f39ad50","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/luckyframework/record/pulls/82/commits","review_comments_url":"https://api.github.com/repos/luckyframework/record/pulls/82/comments","review_comment_url":"https://api.github.com/repos/luckyframework/record/pulls/comments{/number}","comments_url":"https://api.github.com/repos/luckyframework/record/issues/82/comments","statuses_url":"https://api.github.com/repos/luckyframework/record/statuses/2af877ca28fc2faff84e9088cb8d854f8907abf7","head":{"label":"edwardloveall:el-save-bang","ref":"el-save-bang","sha":"2af877ca28fc2faff84e9088cb8d854f8907abf7","user":{"login":"edwardloveall","id":49549,"avatar_url":"https://avatars1.githubusercontent.com/u/49549?v=4","gravatar_id":"","url":"https://api.github.com/users/edwardloveall","html_url":"https://github.com/edwardloveall","followers_url":"https://api.github.com/users/edwardloveall/followers","following_url":"https://api.github.com/users/edwardloveall/following{/other_user}","gists_url":"https://api.github.com/users/edwardloveall/gists{/gist_id}","starred_url":"https://api.github.com/users/edwardloveall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwardloveall/subscriptions","organizations_url":"https://api.github.com/users/edwardloveall/orgs","repos_url":"https://api.github.com/users/edwardloveall/repos","events_url":"https://api.github.com/users/edwardloveall/events{/privacy}","received_events_url":"https://api.github.com/users/edwardloveall/received_events","type":"User","site_admin":false},"repo":{"id":110168386,"name":"record","full_name":"edwardloveall/record","owner":{"login":"edwardloveall","id":49549,"avatar_url":"https://avatars1.githubusercontent.com/u/49549?v=4","gravatar_id":"","url":"https://api.github.com/users/edwardloveall","html_url":"https://github.com/edwardloveall","followers_url":"https://api.github.com/users/edwardloveall/followers","following_url":"https://api.github.com/users/edwardloveall/following{/other_user}","gists_url":"https://api.github.com/users/edwardloveall/gists{/gist_id}","starred_url":"https://api.github.com/users/edwardloveall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwardloveall/subscriptions","organizations_url":"https://api.github.com/users/edwardloveall/orgs","repos_url":"https://api.github.com/users/edwardloveall/repos","events_url":"https://api.github.com/users/edwardloveall/events{/privacy}","received_events_url":"https://api.github.com/users/edwardloveall/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/edwardloveall/record","description":"ORM for Lucky","fork":true,"url":"https://api.github.com/repos/edwardloveall/record","forks_url":"https://api.github.com/repos/edwardloveall/record/forks","keys_url":"https://api.github.com/repos/edwardloveall/record/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edwardloveall/record/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edwardloveall/record/teams","hooks_url":"https://api.github.com/repos/edwardloveall/record/hooks","issue_events_url":"https://api.github.com/repos/edwardloveall/record/issues/events{/number}","events_url":"https://api.github.com/repos/edwardloveall/record/events","assignees_url":"https://api.github.com/repos/edwardloveall/record/assignees{/user}","branches_url":"https://api.github.com/repos/edwardloveall/record/branches{/branch}","tags_url":"https://api.github.com/repos/edwardloveall/record/tags","blobs_url":"https://api.github.com/repos/edwardloveall/record/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edwardloveall/record/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edwardloveall/record/git/refs{/sha}","trees_url":"https://api.github.com/repos/edwardloveall/record/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edwardloveall/record/statuses/{sha}","languages_url":"https://api.github.com/repos/edwardloveall/record/languages","stargazers_url":"https://api.github.com/repos/edwardloveall/record/stargazers","contributors_url":"https://api.github.com/repos/edwardloveall/record/contributors","subscribers_url":"https://api.github.com/repos/edwardloveall/record/subscribers","subscription_url":"https://api.github.com/repos/edwardloveall/record/subscription","commits_url":"https://api.github.com/repos/edwardloveall/record/commits{/sha}","git_commits_url":"https://api.github.com/repos/edwardloveall/record/git/commits{/sha}","comments_url":"https://api.github.com/repos/edwardloveall/record/comments{/number}","issue_comment_url":"https://api.github.com/repos/edwardloveall/record/issues/comments{/number}","contents_url":"https://api.github.com/repos/edwardloveall/record/contents/{+path}","compare_url":"https://api.github.com/repos/edwardloveall/record/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edwardloveall/record/merges","archive_url":"https://api.github.com/repos/edwardloveall/record/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edwardloveall/record/downloads","issues_url":"https://api.github.com/repos/edwardloveall/record/issues{/number}","pulls_url":"https://api.github.com/repos/edwardloveall/record/pulls{/number}","milestones_url":"https://api.github.com/repos/edwardloveall/record/milestones{/number}","notifications_url":"https://api.github.com/repos/edwardloveall/record/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edwardloveall/record/labels{/name}","releases_url":"https://api.github.com/repos/edwardloveall/record/releases{/id}","deployments_url":"https://api.github.com/repos/edwardloveall/record/deployments","created_at":"2017-11-09T21:30:50Z","updated_at":"2017-11-09T21:30:52Z","pushed_at":"2017-11-11T14:38:54Z","git_url":"git://github.com/edwardloveall/record.git","ssh_url":"git@github.com:edwardloveall/record.git","clone_url":"https://github.com/edwardloveall/record.git","svn_url":"https://github.com/edwardloveall/record","homepage":"https://luckyframework.org","size":121,"stargazers_count":0,"watchers_count":0,"language":"Crystal","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"luckyframework:master","ref":"master","sha":"b20525ca404512bdd081ccfd188f7dcc386dc920","user":{"login":"luckyframework","id":24882045,"avatar_url":"https://avatars2.githubusercontent.com/u/24882045?v=4","gravatar_id":"","url":"https://api.github.com/users/luckyframework","html_url":"https://github.com/luckyframework","followers_url":"https://api.github.com/users/luckyframework/followers","following_url":"https://api.github.com/users/luckyframework/following{/other_user}","gists_url":"https://api.github.com/users/luckyframework/gists{/gist_id}","starred_url":"https://api.github.com/users/luckyframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luckyframework/subscriptions","organizations_url":"https://api.github.com/users/luckyframework/orgs","repos_url":"https://api.github.com/users/luckyframework/repos","events_url":"https://api.github.com/users/luckyframework/events{/privacy}","received_events_url":"https://api.github.com/users/luckyframework/received_events","type":"Organization","site_admin":false},"repo":{"id":80232289,"name":"record","full_name":"luckyframework/record","owner":{"login":"luckyframework","id":24882045,"avatar_url":"https://avatars2.githubusercontent.com/u/24882045?v=4","gravatar_id":"","url":"https://api.github.com/users/luckyframework","html_url":"https://github.com/luckyframework","followers_url":"https://api.github.com/users/luckyframework/followers","following_url":"https://api.github.com/users/luckyframework/following{/other_user}","gists_url":"https://api.github.com/users/luckyframework/gists{/gist_id}","starred_url":"https://api.github.com/users/luckyframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luckyframework/subscriptions","organizations_url":"https://api.github.com/users/luckyframework/orgs","repos_url":"https://api.github.com/users/luckyframework/repos","events_url":"https://api.github.com/users/luckyframework/events{/privacy}","received_events_url":"https://api.github.com/users/luckyframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/luckyframework/record","description":"ORM for Lucky","fork":false,"url":"https://api.github.com/repos/luckyframework/record","forks_url":"https://api.github.com/repos/luckyframework/record/forks","keys_url":"https://api.github.com/repos/luckyframework/record/keys{/key_id}","collaborators_url":"https://api.github.com/repos/luckyframework/record/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/luckyframework/record/teams","hooks_url":"https://api.github.com/repos/luckyframework/record/hooks","issue_events_url":"https://api.github.com/repos/luckyframework/record/issues/events{/number}","events_url":"https://api.github.com/repos/luckyframework/record/events","assignees_url":"https://api.github.com/repos/luckyframework/record/assignees{/user}","branches_url":"https://api.github.com/repos/luckyframework/record/branches{/branch}","tags_url":"https://api.github.com/repos/luckyframework/record/tags","blobs_url":"https://api.github.com/repos/luckyframework/record/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/luckyframework/record/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/luckyframework/record/git/refs{/sha}","trees_url":"https://api.github.com/repos/luckyframework/record/git/trees{/sha}","statuses_url":"https://api.github.com/repos/luckyframework/record/statuses/{sha}","languages_url":"https://api.github.com/repos/luckyframework/record/languages","stargazers_url":"https://api.github.com/repos/luckyframework/record/stargazers","contributors_url":"https://api.github.com/repos/luckyframework/record/contributors","subscribers_url":"https://api.github.com/repos/luckyframework/record/subscribers","subscription_url":"https://api.github.com/repos/luckyframework/record/subscription","commits_url":"https://api.github.com/repos/luckyframework/record/commits{/sha}","git_commits_url":"https://api.github.com/repos/luckyframework/record/git/commits{/sha}","comments_url":"https://api.github.com/repos/luckyframework/record/comments{/number}","issue_comment_url":"https://api.github.com/repos/luckyframework/record/issues/comments{/number}","contents_url":"https://api.github.com/repos/luckyframework/record/contents/{+path}","compare_url":"https://api.github.com/repos/luckyframework/record/compare/{base}...{head}","merges_url":"https://api.github.com/repos/luckyframework/record/merges","archive_url":"https://api.github.com/repos/luckyframework/record/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/luckyframework/record/downloads","issues_url":"https://api.github.com/repos/luckyframework/record/issues{/number}","pulls_url":"https://api.github.com/repos/luckyframework/record/pulls{/number}","milestones_url":"https://api.github.com/repos/luckyframework/record/milestones{/number}","notifications_url":"https://api.github.com/repos/luckyframework/record/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/luckyframework/record/labels{/name}","releases_url":"https://api.github.com/repos/luckyframework/record/releases{/id}","deployments_url":"https://api.github.com/repos/luckyframework/record/deployments","created_at":"2017-01-27T18:03:39Z","updated_at":"2017-11-07T23:15:39Z","pushed_at":"2017-11-11T14:38:55Z","git_url":"git://github.com/luckyframework/record.git","ssh_url":"git@github.com:luckyframework/record.git","clone_url":"https://github.com/luckyframework/record.git","svn_url":"https://github.com/luckyframework/record","homepage":"https://luckyframework.org","size":122,"stargazers_count":13,"watchers_count":13,"language":"Crystal","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":30,"forks":6,"open_issues":30,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/luckyframework/record/pulls/82"},"html":{"href":"https://github.com/luckyframework/record/pull/82"},"issue":{"href":"https://api.github.com/repos/luckyframework/record/issues/82"},"comments":{"href":"https://api.github.com/repos/luckyframework/record/issues/82/comments"},"review_comments":{"href":"https://api.github.com/repos/luckyframework/record/pulls/82/comments"},"review_comment":{"href":"https://api.github.com/repos/luckyframework/record/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/luckyframework/record/pulls/82/commits"},"statuses":{"href":"https://api.github.com/repos/luckyframework/record/statuses/2af877ca28fc2faff84e9088cb8d854f8907abf7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"paulcsmith"}}