Skip to content

Commit

Permalink
whitespace cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tcocca committed Oct 16, 2011
1 parent 94c0732 commit 2f6857d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 16 deletions.
4 changes: 1 addition & 3 deletions lib/acts_as_follower.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ module ActsAsFollower
autoload :Followable, 'acts_as_follower/followable'
autoload :FollowerLib, 'acts_as_follower/follower_lib'
autoload :FollowScopes, 'acts_as_follower/follow_scopes'

require 'acts_as_follower/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
end


4 changes: 1 addition & 3 deletions lib/acts_as_follower/follow_scopes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module ActsAsFollower #:nodoc:
module FollowScopes

# Scopes
def for_follower(follower)
where(:follower_id => follower.id, :follower_type => parent_class_name(follower))
end
Expand Down Expand Up @@ -33,7 +32,6 @@ def unblocked
def blocked
where(:blocked => true)
end
# end Scopes


end
end
1 change: 0 additions & 1 deletion lib/acts_as_follower/followable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def acts_as_followable
end
end


module InstanceMethods

# Returns the number of followers a record has.
Expand Down
6 changes: 3 additions & 3 deletions lib/acts_as_follower/follower_lib.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module ActsAsFollower
module FollowerLib

private

# Retrieves the parent class name if using STI.
def parent_class_name(obj)
if obj.class.superclass != ActiveRecord::Base
return obj.class.superclass.name
end
return obj.class.name
end

end
end
6 changes: 3 additions & 3 deletions lib/acts_as_follower/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

module ActsAsFollower
class Railtie < Rails::Railtie

initializer "acts_as_follower.active_record" do |app|
ActiveSupport.on_load :active_record do
include ActsAsFollower::Follower
include ActsAsFollower::Followable
end
end

end
end
end
6 changes: 3 additions & 3 deletions lib/generators/templates/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ class Follow < ActiveRecord::Base

extend ActsAsFollower::FollowerLib
extend ActsAsFollower::FollowScopes

# NOTE: Follows belong to the "followable" interface, and also to followers
belongs_to :followable, :polymorphic => true
belongs_to :follower, :polymorphic => true

def block!
self.update_attribute(:blocked, true)
end

end

0 comments on commit 2f6857d

Please sign in to comment.