Skip to content

Commit

Permalink
Merge pull request #86 from brchristian/hash_colons
Browse files Browse the repository at this point in the history
hash colon syntax
  • Loading branch information
jcoyne committed Jan 31, 2017
2 parents dcebd4d + 3df964c commit c0350e3
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions README.rdoc
Expand Up @@ -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
Expand Down Expand Up @@ -168,7 +168,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
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -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|
Expand Down
12 changes: 6 additions & 6 deletions 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
Expand Down
4 changes: 2 additions & 2 deletions lib/generators/templates/model.rb
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
4 changes: 2 additions & 2 deletions 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

Expand Down
4 changes: 2 additions & 2 deletions test/factories/users.rb
Expand Up @@ -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
18 changes: 9 additions & 9 deletions 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

Expand Down

0 comments on commit c0350e3

Please sign in to comment.