{"action":"created","issue":{"url":"https://api.github.com/repos/apotonick/reform/issues/184","labels_url":"https://api.github.com/repos/apotonick/reform/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/apotonick/reform/issues/184/comments","events_url":"https://api.github.com/repos/apotonick/reform/issues/184/events","html_url":"https://github.com/apotonick/reform/issues/184","id":53987882,"number":184,"title":"Ability to define Contracts in modules and reuse them in other Contracts or Forms","user":{"login":"dhampik","id":586400,"avatar_url":"https://avatars.githubusercontent.com/u/586400?v=3","gravatar_id":"","url":"https://api.github.com/users/dhampik","html_url":"https://github.com/dhampik","followers_url":"https://api.github.com/users/dhampik/followers","following_url":"https://api.github.com/users/dhampik/following{/other_user}","gists_url":"https://api.github.com/users/dhampik/gists{/gist_id}","starred_url":"https://api.github.com/users/dhampik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhampik/subscriptions","organizations_url":"https://api.github.com/users/dhampik/orgs","repos_url":"https://api.github.com/users/dhampik/repos","events_url":"https://api.github.com/users/dhampik/events{/privacy}","received_events_url":"https://api.github.com/users/dhampik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-11T10:25:16Z","updated_at":"2015-01-11T12:21:57Z","closed_at":null,"body":"I was reading this disscussion https://github.com/apotonick/reform/issues/106 and thought that it would actually be great to reuse as modules not only Forms, but Contracts as well.\r\n\r\nSo how about moving module functionality to Contracts (suppose Forms are inherited from them, so they will also get this).\r\n\r\nIf we do so, we will be able to do the following:\r\n1. Decouple validations from models into Contracts\r\n2. Use those Contracts for validations for data which comes from rake tasks (like import) or external sources. Note, that using forms for that kind of stuff is not obvious at all.\r\n3. Reuse those Contracts in Forms\r\n\r\nSo, basically, I propose the feature described here https://github.com/apotonick/reform#forms-in-modules to be implemented for Contracts.\r\n\r\n@apotonick, what do you think about it?"},"comment":{"url":"https://api.github.com/repos/apotonick/reform/issues/comments/69492652","html_url":"https://github.com/apotonick/reform/issues/184#issuecomment-69492652","issue_url":"https://api.github.com/repos/apotonick/reform/issues/184","id":69492652,"user":{"login":"dhampik","id":586400,"avatar_url":"https://avatars.githubusercontent.com/u/586400?v=3","gravatar_id":"","url":"https://api.github.com/users/dhampik","html_url":"https://github.com/dhampik","followers_url":"https://api.github.com/users/dhampik/followers","following_url":"https://api.github.com/users/dhampik/following{/other_user}","gists_url":"https://api.github.com/users/dhampik/gists{/gist_id}","starred_url":"https://api.github.com/users/dhampik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhampik/subscriptions","organizations_url":"https://api.github.com/users/dhampik/orgs","repos_url":"https://api.github.com/users/dhampik/repos","events_url":"https://api.github.com/users/dhampik/events{/privacy}","received_events_url":"https://api.github.com/users/dhampik/received_events","type":"User","site_admin":false},"created_at":"2015-01-11T12:21:57Z","updated_at":"2015-01-11T12:21:57Z","body":"Looks like you are right.\r\nBut probably it would be more obivous to move lib/reform/form/module.rb to lib/reform/contract/module.rb ?"}}