Created
November 9, 2010 05:42
-
-
Save matthuhiggins/668764 to your computer and use it in GitHub Desktop.
can haz namespaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
belongs_to :session, :class_name => "Statistics::Session" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.active_record.observers = 'statistics/request_observer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
short_request: | |
milliseconds: 1 | |
session: <%= Fixtures.identify(:long_session) %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long_session: | |
start: 2008-08-13 21:32:32 | |
end: 2008-08-13 21:32:32 | |
short_request: | |
milliseconds: 1 | |
session: long_session |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create_table :statistics_sessions do |t| | |
t.datetime :start, :end | |
end | |
change_table :statistics_requests do |t| | |
t.integer :session_id | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Base.class_eval do | |
def self.table_name | |
name.split("::").map { |package| package.underscore.pluralize }.join("_") | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Statistics::Request < ActiveRecord::Base | |
belongs_to :session | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Statistics::RequestObserver < ActiveRecord::Observer | |
def after_create(request) | |
puts "We got a hit!!!" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment