I use this type of code for different message and status in my api. def 404 respond_to do |format| format.json {render json: { error: '404, not found' }, status: 404} format.xml {render xml: { error: '404, not found' }, status: 404} end end
This works but can I refactoring this code, maybe to one single line? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/99851274269a17cf0ad8927be8c7dfa4%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.