I am using Rails 4 i am trying to set an api and i have a services controller where i def some methods like this:
def articles_stores
@article = Store.find(params[:id])
if @article.nil?
render :json => {:error_msg => "Record not found",:error_code => 404,:success => false}
else
render json: {article: @article.as_json({except: [:updated_at,:created_at]}),success: true}
end
end
But for some reason it is not rendering the error the else part works fine y also have all the necessary routes Any help will be appreciated