Skip to content

Instantly share code, notes, and snippets.

@saturnflyer
Created April 17, 2013 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saturnflyer/5403871 to your computer and use it in GitHub Desktop.
Save saturnflyer/5403871 to your computer and use it in GitHub Desktop.
What I want to do with representable
class Mapper
with_options :prefix => 'special_' do
property :id
property :name
property :other
end
end
# This would yield {"special_id" => 1, "special_name" => 'something', "special_other" => 'other value' }
@apotonick
Copy link

So you still wanna access #name but in the document it should be special_name?

We were thinking about some general default configuration for representable, maybe something like

module Mapper
  defaults options: {prefix: :special}
end

Would that help? It would be applied to all properties, though. I start liking that with_options block, damnit.. let me think about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment