Re: [Rails] Better way to write this piece of code

2016-02-17 Thread Tamara Temple
Roy Royal writes: > 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

[Rails] Better way to write this piece of code

2016-02-17 Thread Roy Royal
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,