Project

General

Profile

« Previous | Next » 

Revision b6e0cb16

Added by Ohad Levy over 13 years ago

fixes #454 - Foreman render 500 instead of 404

  • Fixes the not found method
  • generalize the find_by_obj_name method so we DRY abit more

View differences:

app/controllers/application_controller.rb
end
def not_found
render :text => "404 Not Found\n", :status => 404
respond_to do |format|
format.html { render "common/404", :status => 404 }
format.json { head :status => 404}
format.yaml { head :status => 404}
format.yml { head :status => 404}
end
return true
end
def setgraph chart, data, options = {}
......
User.current = User.find_by_login("admin")
end
# searchs for an object based on its name and assign it to an instance variable
# required for models which implement the to_param method
#
# example:
# @host = Host.find_by_name params[:id]
def find_by_name
if params[:id]
obj = controller_name.singularize
not_found and return unless eval("@#{obj} = #{obj.camelize}.find_by_name(params[:id])")
end
end
private
def detect_notices
@notices = current_user.notices

Also available in: Unified diff