You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it would be nice to skip or include links in the same way you can do it now with plain old properties; maybe something along the lines of model.to_json include_links: :self
or even model.to_json include: :self
Currently I have to resort to hackery like this in the representer
class << self
alias_method :_ye_olde_link, :link
def link(rel, *args, &block)
_ye_olde_link rel, *args do |opts|
props = opts[:links_exclude] || opts[:links_include]
if props
ignore = props.include? rel
ignore = opts[:links_include]? !ignore : ignore
else
ignore = false
end
ignore ? nil : instance_exec(opts, &block)
end
end
end
And then call model.to_json include: :links, include_links: [:self]
Not nice at all... It gets the job done though
The text was updated successfully, but these errors were encountered:
I think it would be nice to skip or include links in the same way you can do it now with plain old properties; maybe something along the lines of
model.to_json include_links: :self
or even
model.to_json include: :self
Currently I have to resort to hackery like this in the representer
And then call
model.to_json include: :links, include_links: [:self]
Not nice at all... It gets the job done though
The text was updated successfully, but these errors were encountered: