{"action":"created","issue":{"url":"https://api.github.com/repos/apotonick/roar/issues/155","labels_url":"https://api.github.com/repos/apotonick/roar/issues/155/labels{/name}","comments_url":"https://api.github.com/repos/apotonick/roar/issues/155/comments","events_url":"https://api.github.com/repos/apotonick/roar/issues/155/events","html_url":"https://github.com/apotonick/roar/issues/155","id":106304049,"number":155,"title":"Any easier way for rendering custom properties","user":{"login":"PikachuEXE","id":1018543,"avatar_url":"https://avatars.githubusercontent.com/u/1018543?v=3","gravatar_id":"","url":"https://api.github.com/users/PikachuEXE","html_url":"https://github.com/PikachuEXE","followers_url":"https://api.github.com/users/PikachuEXE/followers","following_url":"https://api.github.com/users/PikachuEXE/following{/other_user}","gists_url":"https://api.github.com/users/PikachuEXE/gists{/gist_id}","starred_url":"https://api.github.com/users/PikachuEXE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PikachuEXE/subscriptions","organizations_url":"https://api.github.com/users/PikachuEXE/orgs","repos_url":"https://api.github.com/users/PikachuEXE/repos","events_url":"https://api.github.com/users/PikachuEXE/events{/privacy}","received_events_url":"https://api.github.com/users/PikachuEXE/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-14T09:27:31Z","updated_at":"2015-09-14T23:53:02Z","closed_at":null,"body":"I am using cells (concept cells)\r\nSo I kind of expect support for similar syntax in representable\r\nBut this is what I need for rendering a controller loaded neighbourhoods (with a city):\r\n```ruby\r\nclass MyRepresenter < Roar::Decorator\r\n          include Roar::JSON\r\n\r\n          self.representation_wrap = :city\r\n\r\n          collection :neighbourhoods, getter: -> (args) {\r\n            args[:neighbourhoods]\r\n          } do\r\n            property :name\r\n          end\r\nend\r\n\r\nMyRepresenter.new(city).to_json(neighbourhoods: my_custom_neighbourhoods)\r\n```\r\nI kind of expect\r\n```ruby\r\nclass MyRepresenter < Roar::Decorator\r\n          include Roar::JSON\r\n          include Roar::SomeMagicModule # :P\r\n\r\n          self.representation_wrap = :city\r\n\r\n          collection :neighbourhoods do\r\n            property :name\r\n          end\r\n          \r\n          private\r\n\r\n          def neighbourhoods\r\n             args[:neighbourhoods] # Still not the best form but still better than setting a lambda in option\r\n          end\r\nend\r\n\r\nMyRepresenter.new(city, neighbourhoods: my_custom_neighbourhoods)\r\n```\r\n\r\nI understand the class might also used for parsing input\r\nBut is there anyway to NOT use option to get custom input?\r\nOr I should use a custom class (e.g. `Struct`) for carrying the data into the representer?"},"comment":{"url":"https://api.github.com/repos/apotonick/roar/issues/comments/140235511","html_url":"https://github.com/apotonick/roar/issues/155#issuecomment-140235511","issue_url":"https://api.github.com/repos/apotonick/roar/issues/155","id":140235511,"user":{"login":"apotonick","id":10406,"avatar_url":"https://avatars.githubusercontent.com/u/10406?v=3","gravatar_id":"","url":"https://api.github.com/users/apotonick","html_url":"https://github.com/apotonick","followers_url":"https://api.github.com/users/apotonick/followers","following_url":"https://api.github.com/users/apotonick/following{/other_user}","gists_url":"https://api.github.com/users/apotonick/gists{/gist_id}","starred_url":"https://api.github.com/users/apotonick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apotonick/subscriptions","organizations_url":"https://api.github.com/users/apotonick/orgs","repos_url":"https://api.github.com/users/apotonick/repos","events_url":"https://api.github.com/users/apotonick/events{/privacy}","received_events_url":"https://api.github.com/users/apotonick/received_events","type":"User","site_admin":false},"created_at":"2015-09-14T23:53:02Z","updated_at":"2015-09-14T23:53:02Z","body":"I recommend using a domain object (e.g. OpenStruct) that reflects your concern and pass that into the representer. \r\n\r\nI keep repeating myself, but forms, cells, and representers are no data-mappers, they use data objects to (re-)present them, and even though they provide some tools for mapping this should happen on the outside.\r\n\r\nIn the coming months I will push the idea of twins and ROM since domain/data modelling must be a first-class citizen of software engineering."}}