Commit 3df964c84b4d5d5d2e9a6b47ac1d66eab7d7f67f
1 parent
c395dd2f
Exists in
master
hash colons
Showing
8 changed files
with
25 additions
and
25 deletions
Show diff stats
README.rdoc
@@ -33,7 +33,7 @@ Add the gem to the gemfile: | @@ -33,7 +33,7 @@ Add the gem to the gemfile: | ||
33 | 33 | ||
34 | or install from the branch | 34 | or install from the branch |
35 | 35 | ||
36 | - gem "acts_as_follower", :git => 'git://github.com/tcocca/acts_as_follower.git', :branch => 'rails_3' | 36 | + gem "acts_as_follower", git: 'git://github.com/tcocca/acts_as_follower.git', branch: 'rails_3' |
37 | 37 | ||
38 | Run the generator: | 38 | Run the generator: |
39 | rails generate acts_as_follower | 39 | rails generate acts_as_follower |
@@ -180,7 +180,7 @@ If you only need the number of blocks use the count method provided | @@ -180,7 +180,7 @@ If you only need the number of blocks use the count method provided | ||
180 | book.blocked_followers_count | 180 | book.blocked_followers_count |
181 | 181 | ||
182 | Unblocking deletes all records of that follow, instead of just the :blocked attribute => false the follow is deleted. So, a user would need to try and follow the book again. | 182 | Unblocking deletes all records of that follow, instead of just the :blocked attribute => false the follow is deleted. So, a user would need to try and follow the book again. |
183 | -I would like to hear thoughts on this, I may change this to make the follow as :blocked => false instead of deleting the record. | 183 | +I would like to hear thoughts on this, I may change this to make the follow as blocked: false instead of deleting the record. |
184 | 184 | ||
185 | The following methods take an optional hash parameter of ActiveRecord options (:limit, :order, etc...) | 185 | The following methods take an optional hash parameter of ActiveRecord options (:limit, :order, etc...) |
186 | followers_by_type, followers, blocks | 186 | followers_by_type, followers, blocks |
Rakefile
@@ -6,7 +6,7 @@ require 'rake/testtask' | @@ -6,7 +6,7 @@ require 'rake/testtask' | ||
6 | require 'rdoc/task' | 6 | require 'rdoc/task' |
7 | 7 | ||
8 | desc 'Default: run unit tests.' | 8 | desc 'Default: run unit tests.' |
9 | -task :default => :test | 9 | +task default: :test |
10 | 10 | ||
11 | desc 'Test the acts_as_follower gem.' | 11 | desc 'Test the acts_as_follower gem.' |
12 | Rake::TestTask.new(:test) do |t| | 12 | Rake::TestTask.new(:test) do |t| |
lib/generators/templates/migration.rb
1 | class ActsAsFollowerMigration < ActiveRecord::Migration | 1 | class ActsAsFollowerMigration < ActiveRecord::Migration |
2 | def self.up | 2 | def self.up |
3 | - create_table :follows, :force => true do |t| | ||
4 | - t.references :followable, :polymorphic => true, :null => false | ||
5 | - t.references :follower, :polymorphic => true, :null => false | ||
6 | - t.boolean :blocked, :default => false, :null => false | 3 | + create_table :follows, force: true do |t| |
4 | + t.references :followable, polymorphic: true, null: false | ||
5 | + t.references :follower, polymorphic: true, null: false | ||
6 | + t.boolean :blocked, default: false, null: false | ||
7 | t.timestamps | 7 | t.timestamps |
8 | end | 8 | end |
9 | 9 | ||
10 | - add_index :follows, ["follower_id", "follower_type"], :name => "fk_follows" | ||
11 | - add_index :follows, ["followable_id", "followable_type"], :name => "fk_followables" | 10 | + add_index :follows, ["follower_id", "follower_type"], name: "fk_follows" |
11 | + add_index :follows, ["followable_id", "followable_type"], name: "fk_followables" | ||
12 | end | 12 | end |
13 | 13 | ||
14 | def self.down | 14 | def self.down |
lib/generators/templates/model.rb
@@ -4,8 +4,8 @@ class Follow < ActiveRecord::Base | @@ -4,8 +4,8 @@ class Follow < ActiveRecord::Base | ||
4 | extend ActsAsFollower::FollowScopes | 4 | extend ActsAsFollower::FollowScopes |
5 | 5 | ||
6 | # NOTE: Follows belong to the "followable" and "follower" interface | 6 | # NOTE: Follows belong to the "followable" and "follower" interface |
7 | - belongs_to :followable, :polymorphic => true | ||
8 | - belongs_to :follower, :polymorphic => true | 7 | + belongs_to :followable, polymorphic: true |
8 | + belongs_to :follower, polymorphic: true | ||
9 | 9 | ||
10 | def block! | 10 | def block! |
11 | self.update_attribute(:blocked, true) | 11 | self.update_attribute(:blocked, true) |
test/dummy30/config/initializers/session_store.rb
1 | # Be sure to restart your server when you modify this file. | 1 | # Be sure to restart your server when you modify this file. |
2 | 2 | ||
3 | -Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session' | 3 | +Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' |
4 | 4 | ||
5 | # Use the database for sessions instead of the cookie-based default, | 5 | # Use the database for sessions instead of the cookie-based default, |
6 | # which shouldn't be used to store highly confidential information | 6 | # which shouldn't be used to store highly confidential information |
test/factories/bands.rb
1 | FactoryGirl.define do | 1 | FactoryGirl.define do |
2 | - factory :oasis, :class => Band do |b| | 2 | + factory :oasis, class: Band do |b| |
3 | b.name 'Oasis' | 3 | b.name 'Oasis' |
4 | end | 4 | end |
5 | 5 | ||
6 | - factory :metallica, :class => Band do |b| | 6 | + factory :metallica, class: Band do |b| |
7 | b.name 'Metallica' | 7 | b.name 'Metallica' |
8 | end | 8 | end |
9 | end | 9 | end |
test/factories/users.rb
@@ -3,11 +3,11 @@ FactoryGirl.define do | @@ -3,11 +3,11 @@ FactoryGirl.define do | ||
3 | u.name 'Jon' | 3 | u.name 'Jon' |
4 | end | 4 | end |
5 | 5 | ||
6 | - factory :sam, :class => User do |u| | 6 | + factory :sam, class: User do |u| |
7 | u.name 'Sam' | 7 | u.name 'Sam' |
8 | end | 8 | end |
9 | 9 | ||
10 | - factory :bob, :class => User do |u| | 10 | + factory :bob, class: User do |u| |
11 | u.name 'Bob' | 11 | u.name 'Bob' |
12 | end | 12 | end |
13 | end | 13 | end |
test/schema.rb
1 | -ActiveRecord::Schema.define :version => 0 do | 1 | +ActiveRecord::Schema.define version: 0 do |
2 | 2 | ||
3 | - create_table :follows, :force => true do |t| | ||
4 | - t.integer "followable_id", :null => false | ||
5 | - t.string "followable_type", :null => false | ||
6 | - t.integer "follower_id", :null => false | ||
7 | - t.string "follower_type", :null => false | ||
8 | - t.boolean "blocked", :default => false, :null => false | 3 | + create_table :follows, force: true do |t| |
4 | + t.integer "followable_id", null: false | ||
5 | + t.string "followable_type", null: false | ||
6 | + t.integer "follower_id", null: false | ||
7 | + t.string "follower_type", null: false | ||
8 | + t.boolean "blocked", default: false, null: false | ||
9 | t.datetime "created_at" | 9 | t.datetime "created_at" |
10 | t.datetime "updated_at" | 10 | t.datetime "updated_at" |
11 | end | 11 | end |
12 | 12 | ||
13 | - create_table :users, :force => true do |t| | 13 | + create_table :users, force: true do |t| |
14 | t.column :name, :string | 14 | t.column :name, :string |
15 | end | 15 | end |
16 | 16 | ||
17 | - create_table :bands, :force => true do |t| | 17 | + create_table :bands, force: true do |t| |
18 | t.column :name, :string | 18 | t.column :name, :string |
19 | end | 19 | end |
20 | 20 |