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 | 33 | |
34 | 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 | 38 | Run the generator: |
39 | 39 | rails generate acts_as_follower |
... | ... | @@ -180,7 +180,7 @@ If you only need the number of blocks use the count method provided |
180 | 180 | book.blocked_followers_count |
181 | 181 | |
182 | 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 | 185 | The following methods take an optional hash parameter of ActiveRecord options (:limit, :order, etc...) |
186 | 186 | followers_by_type, followers, blocks | ... | ... |
Rakefile
lib/generators/templates/migration.rb
1 | 1 | class ActsAsFollowerMigration < ActiveRecord::Migration |
2 | 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 | 7 | t.timestamps |
8 | 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 | 12 | end |
13 | 13 | |
14 | 14 | def self.down | ... | ... |
lib/generators/templates/model.rb
... | ... | @@ -4,8 +4,8 @@ class Follow < ActiveRecord::Base |
4 | 4 | extend ActsAsFollower::FollowScopes |
5 | 5 | |
6 | 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 | 10 | def block! |
11 | 11 | self.update_attribute(:blocked, true) | ... | ... |
test/dummy30/config/initializers/session_store.rb
1 | 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 | 5 | # Use the database for sessions instead of the cookie-based default, |
6 | 6 | # which shouldn't be used to store highly confidential information | ... | ... |
test/factories/bands.rb
test/factories/users.rb
... | ... | @@ -3,11 +3,11 @@ FactoryGirl.define do |
3 | 3 | u.name 'Jon' |
4 | 4 | end |
5 | 5 | |
6 | - factory :sam, :class => User do |u| | |
6 | + factory :sam, class: User do |u| | |
7 | 7 | u.name 'Sam' |
8 | 8 | end |
9 | 9 | |
10 | - factory :bob, :class => User do |u| | |
10 | + factory :bob, class: User do |u| | |
11 | 11 | u.name 'Bob' |
12 | 12 | end |
13 | 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 | 9 | t.datetime "created_at" |
10 | 10 | t.datetime "updated_at" |
11 | 11 | end |
12 | 12 | |
13 | - create_table :users, :force => true do |t| | |
13 | + create_table :users, force: true do |t| | |
14 | 14 | t.column :name, :string |
15 | 15 | end |
16 | 16 | |
17 | - create_table :bands, :force => true do |t| | |
17 | + create_table :bands, force: true do |t| | |
18 | 18 | t.column :name, :string |
19 | 19 | end |
20 | 20 | ... | ... |