Closed BenSwennen closed 8 years ago
I was having the same issue and found a workaround:
Add a third file, I called it 'base', include what used to be in show contacts/base.json.rabl node(:id) { |contact| contact.id.to_s } attributes :name
have both index and show extend base
contacts/index.json.rabl collection :@contacts extends 'contacts/base'
contacts/show.json.rabl object :@contact extends 'contacts/base'
When using extends I'm getting the following error:
contacts/index.json.rabl:
contacts/show.json.rabl
If I render only index, it works perfectly, but after rendering show and then rendering index again, it gives me the error. If I then change
node(:id) { |contact| contact.id.to_s }
tonode(:id) { |c| c.id.to_s }
it works again, until I render the show. If I removenode(:id) { |contact| contact.id.to_s }
it works perfectly normal Index also works if I doobject :contact
(w/o the @) in show.json.rabl but then ofcourse the show method fails.