From 3df964c84b4d5d5d2e9a6b47ac1d66eab7d7f67f Mon Sep 17 00:00:00 2001 From: Brian Christian Date: Fri, 23 Dec 2016 21:49:48 -0800 Subject: [PATCH] hash colons --- README.rdoc | 4 ++-- Rakefile | 2 +- lib/generators/templates/migration.rb | 12 ++++++------ lib/generators/templates/model.rb | 4 ++-- .../config/initializers/session_store.rb | 2 +- test/factories/bands.rb | 4 ++-- test/factories/users.rb | 4 ++-- test/schema.rb | 18 +++++++++--------- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/README.rdoc b/README.rdoc index cc3ef28..82c7169 100644 --- a/README.rdoc +++ b/README.rdoc @@ -33,7 +33,7 @@ Add the gem to the gemfile: or install from the branch - gem "acts_as_follower", :git => 'git://github.com/tcocca/acts_as_follower.git', :branch => 'rails_3' + gem "acts_as_follower", git: 'git://github.com/tcocca/acts_as_follower.git', branch: 'rails_3' Run the generator: rails generate acts_as_follower @@ -180,7 +180,7 @@ If you only need the number of blocks use the count method provided book.blocked_followers_count 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. -I would like to hear thoughts on this, I may change this to make the follow as :blocked => false instead of deleting the record. +I would like to hear thoughts on this, I may change this to make the follow as blocked: false instead of deleting the record. The following methods take an optional hash parameter of ActiveRecord options (:limit, :order, etc...) followers_by_type, followers, blocks diff --git a/Rakefile b/Rakefile index ab56276..15e0ea1 100644 --- a/Rakefile +++ b/Rakefile @@ -6,7 +6,7 @@ require 'rake/testtask' require 'rdoc/task' desc 'Default: run unit tests.' -task :default => :test +task default: :test desc 'Test the acts_as_follower gem.' Rake::TestTask.new(:test) do |t| diff --git a/lib/generators/templates/migration.rb b/lib/generators/templates/migration.rb index d6a60c0..0b39c01 100644 --- a/lib/generators/templates/migration.rb +++ b/lib/generators/templates/migration.rb @@ -1,14 +1,14 @@ class ActsAsFollowerMigration < ActiveRecord::Migration def self.up - create_table :follows, :force => true do |t| - t.references :followable, :polymorphic => true, :null => false - t.references :follower, :polymorphic => true, :null => false - t.boolean :blocked, :default => false, :null => false + create_table :follows, force: true do |t| + t.references :followable, polymorphic: true, null: false + t.references :follower, polymorphic: true, null: false + t.boolean :blocked, default: false, null: false t.timestamps end - add_index :follows, ["follower_id", "follower_type"], :name => "fk_follows" - add_index :follows, ["followable_id", "followable_type"], :name => "fk_followables" + add_index :follows, ["follower_id", "follower_type"], name: "fk_follows" + add_index :follows, ["followable_id", "followable_type"], name: "fk_followables" end def self.down diff --git a/lib/generators/templates/model.rb b/lib/generators/templates/model.rb index c7abde3..b8a8607 100644 --- a/lib/generators/templates/model.rb +++ b/lib/generators/templates/model.rb @@ -4,8 +4,8 @@ class Follow < ActiveRecord::Base extend ActsAsFollower::FollowScopes # NOTE: Follows belong to the "followable" and "follower" interface - belongs_to :followable, :polymorphic => true - belongs_to :follower, :polymorphic => true + belongs_to :followable, polymorphic: true + belongs_to :follower, polymorphic: true def block! self.update_attribute(:blocked, true) diff --git a/test/dummy30/config/initializers/session_store.rb b/test/dummy30/config/initializers/session_store.rb index aa2f512..952473f 100644 --- a/test/dummy30/config/initializers/session_store.rb +++ b/test/dummy30/config/initializers/session_store.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session' +Dummy::Application.config.session_store :cookie_store, key: '_dummy_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information diff --git a/test/factories/bands.rb b/test/factories/bands.rb index 3e6eb9b..5c46670 100644 --- a/test/factories/bands.rb +++ b/test/factories/bands.rb @@ -1,9 +1,9 @@ FactoryGirl.define do - factory :oasis, :class => Band do |b| + factory :oasis, class: Band do |b| b.name 'Oasis' end - factory :metallica, :class => Band do |b| + factory :metallica, class: Band do |b| b.name 'Metallica' end end diff --git a/test/factories/users.rb b/test/factories/users.rb index b819f61..ff43e73 100644 --- a/test/factories/users.rb +++ b/test/factories/users.rb @@ -3,11 +3,11 @@ u.name 'Jon' end - factory :sam, :class => User do |u| + factory :sam, class: User do |u| u.name 'Sam' end - factory :bob, :class => User do |u| + factory :bob, class: User do |u| u.name 'Bob' end end diff --git a/test/schema.rb b/test/schema.rb index 9f18a3f..b3eb50c 100644 --- a/test/schema.rb +++ b/test/schema.rb @@ -1,20 +1,20 @@ -ActiveRecord::Schema.define :version => 0 do +ActiveRecord::Schema.define version: 0 do - create_table :follows, :force => true do |t| - t.integer "followable_id", :null => false - t.string "followable_type", :null => false - t.integer "follower_id", :null => false - t.string "follower_type", :null => false - t.boolean "blocked", :default => false, :null => false + create_table :follows, force: true do |t| + t.integer "followable_id", null: false + t.string "followable_type", null: false + t.integer "follower_id", null: false + t.string "follower_type", null: false + t.boolean "blocked", default: false, null: false t.datetime "created_at" t.datetime "updated_at" end - create_table :users, :force => true do |t| + create_table :users, force: true do |t| t.column :name, :string end - create_table :bands, :force => true do |t| + create_table :bands, force: true do |t| t.column :name, :string end