I am using Rails 3.2.11. I have an action (show) that I would like to disable if a certain attribute in the model is not set. Right now I am dealing with this directly in the action:
def show
@model = Model.find(params[:id])
if !@model.attribute
raise ActionController::RoutingError.new('Something bad happened')
end
end
Is this acceptable or is there a better way of handling this situation? I would like the behavior to be the same as when a user tries to access a non-existent record.