Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 173
- Log:
Updated to latest release of Beast according to the "getting started with
Beast" guide at:http://beast.caboo.se/forums/1/topics/381
This check-in includes frozen Edge Rails and has the beginnings of
configuration for the ROOL site included.
- Author:
- rool
- Date:
- Fri Mar 02 15:59:12 +0000 2007
- Size:
- 2228 Bytes
1 | class LoggedException < ActiveRecord::Base |
2 | class << self |
3 | def create_from_exception(controller, exception) |
4 | create! \ |
5 | :exception_class => exception.class.name, |
6 | :controller_name => controller.controller_name, |
7 | :action_name => controller.action_name, |
8 | :message => exception.message.inspect, |
9 | :backtrace => exception.backtrace, |
10 | :request => controller.request |
11 | end |
12 | |
13 | def find_exception_class_names |
14 | connection.select_values "SELECT DISTINCT exception_class FROM #{table_name} ORDER BY exception_class" |
15 | end |
16 | |
17 | def find_exception_controllers_and_actions |
18 | find(:all, :select => "DISTINCT controller_name, action_name", :order => "controller_name, action_name").collect(&:controller_action) |
19 | end |
20 | |
21 | def host_name |
22 | `hostname -s`.chomp |
23 | end |
24 | end |
25 | |
26 | def backtrace=(backtrace) |
27 | if backtrace.is_a?(String) |
28 | write_attribute :backtrace, backtrace |
29 | else |
30 | re = Regexp.new(/^#{Regexp.escape(rails_root)}/) |
31 | write_attribute(:backtrace, backtrace.collect { |line| Pathname.new(line.gsub(re, "[RAILS_ROOT]")).cleanpath.to_s } * "\n") |
32 | end |
33 | end |
34 | |
35 | def request=(request) |
36 | if request.is_a?(String) |
37 | write_attribute :request, request |
38 | else |
39 | max = request.env.keys.max { |a,b| a.length <=> b.length } |
40 | env = request.env.keys.sort.inject [] do |env, key| |
41 | env << '* ' + ("%*-s: %s" % [max.length, key, request.env[key].to_s.strip]) |
42 | end |
43 | write_attribute(:environment, (env << "* Process: #{$$}" << "* Server : #{self.class.host_name}") * "\n") |
44 | |
45 | write_attribute(:request, [ |
46 | "* URL: #{request.protocol}#{request.env["HTTP_HOST"]}#{request.request_uri}", |
47 | "* Parameters: #{request.parameters.inspect}", |
48 | "* Rails Root: #{rails_root}" |
49 | ] * "\n") |
50 | end |
51 | end |
52 | |
53 | def controller_action |
54 | "#{controller_name.camelcase}/#{action_name}" |
55 | end |
56 | |
57 | private |
58 | def sanitize_backtrace(trace) |
59 | re = Regexp.new(/^#{Regexp.escape(rails_root)}/) |
60 | trace.map { |line| Pathname.new(line.gsub(re, "[RAILS_ROOT]")).cleanpath.to_s } |
61 | end |
62 | |
63 | def rails_root |
64 | @rails_root ||= Pathname.new(RAILS_ROOT).cleanpath.to_s |
65 | end |
66 | end |