Skip to content

Instantly share code, notes, and snippets.

@pezra
Created July 6, 2010 23:42
Show Gist options
  • Save pezra/466098 to your computer and use it in GitHub Desktop.
Save pezra/466098 to your computer and use it in GitHub Desktop.
class MyResource
include Spinal::Resource
representation :simple, :media_types => [:ufe, :ssj, :myxml] , :direction => :in_and_out do |rep|
rep.attribute :foo
rep.attribute :bar, :required => true
end
repesentation :html, :parent => :simple, :direction => :out do |rep|
rep.attribute :current_user
end
def get()
# ...
create_representation(:foo => my_model.foo, :bar => my_model.bar, :current_user => current_user)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment