From e044441ad244033c6c2af9a4a4c76e1ca32910e3 Mon Sep 17 00:00:00 2001 From: Mathieu Martin Date: Thu, 19 Feb 2009 15:02:56 -0500 Subject: [PATCH] secondary_actor => secondary_subject --- generators/timeline_event/templates/model.rb | 5 ----- generators/{timeline_event => timeline_fu}/USAGE | 0 .../{timeline_event => timeline_fu}/templates/migration.rb | 4 ++-- generators/timeline_fu/templates/model.rb | 5 +++++ .../timeline_event_generator.rb | 0 lib/timeline_fu/fires.rb | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 generators/timeline_event/templates/model.rb rename generators/{timeline_event => timeline_fu}/USAGE (100%) rename generators/{timeline_event => timeline_fu}/templates/migration.rb (89%) create mode 100644 generators/timeline_fu/templates/model.rb rename generators/{timeline_event => timeline_fu}/timeline_event_generator.rb (100%) diff --git a/generators/timeline_event/templates/model.rb b/generators/timeline_event/templates/model.rb deleted file mode 100644 index 8f84fe4..0000000 --- a/generators/timeline_event/templates/model.rb +++ /dev/null @@ -1,5 +0,0 @@ -class TimelineEvent < ActiveRecord::Base - belongs_to :subject, :polymorphic => true - belongs_to :actor, :polymorphic => true - belongs_to :secondary_actor, :polymorphic => true -end diff --git a/generators/timeline_event/USAGE b/generators/timeline_fu/USAGE similarity index 100% rename from generators/timeline_event/USAGE rename to generators/timeline_fu/USAGE diff --git a/generators/timeline_event/templates/migration.rb b/generators/timeline_fu/templates/migration.rb similarity index 89% rename from generators/timeline_event/templates/migration.rb rename to generators/timeline_fu/templates/migration.rb index 4035429..316bded 100644 --- a/generators/timeline_event/templates/migration.rb +++ b/generators/timeline_fu/templates/migration.rb @@ -1,8 +1,8 @@ class CreateTimelineEvents < ActiveRecord::Migration def self.up create_table :timeline_events do |t| - t.string :event_type, :subject_type, :actor_type, :secondary_actor_type - t.integer :subject_id, :actor_id, :secondary_actor_id + t.string :event_type, :subject_type, :actor_type, :secondary_subject_type + t.integer :subject_id, :actor_id, :secondary_subject_id t.timestamps end end diff --git a/generators/timeline_fu/templates/model.rb b/generators/timeline_fu/templates/model.rb new file mode 100644 index 0000000..2731b29 --- /dev/null +++ b/generators/timeline_fu/templates/model.rb @@ -0,0 +1,5 @@ +class TimelineEvent < ActiveRecord::Base + belongs_to :subject, :polymorphic => true + belongs_to :actor, :polymorphic => true + belongs_to :secondary_subject, :polymorphic => true +end diff --git a/generators/timeline_event/timeline_event_generator.rb b/generators/timeline_fu/timeline_event_generator.rb similarity index 100% rename from generators/timeline_event/timeline_event_generator.rb rename to generators/timeline_fu/timeline_event_generator.rb diff --git a/lib/timeline_fu/fires.rb b/lib/timeline_fu/fires.rb index eba5e05..14b571a 100644 --- a/lib/timeline_fu/fires.rb +++ b/lib/timeline_fu/fires.rb @@ -15,7 +15,7 @@ def fires(event_type, opts) raise MissingOnArgument.new(opts) unless opts.has_key?(:on) method_name = :"fire_#{event_type}_after_#{opts[:on]}" define_method(method_name) do - create_options = [:subject, :actor, :secondary_actor].inject({}) do |memo, sym| + create_options = [:actor, :subject, :secondary_subject].inject({}) do |memo, sym| memo[sym] = send(opts[sym]) if opts[sym] memo end