Permalink
Browse files

Merge pull request #86 from brchristian/hash_colons

hash colon syntax
  • Loading branch information...
jcoyne committed Jan 31, 2017
2 parents dcebd4d + 3df964c commit c0350e36da7fdabc6fb6b5d0179d1d8cc6159f4e
View
@@ -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
@@ -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
View
@@ -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|
@@ -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
@@ -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)
@@ -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
View
@@ -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
View
@@ -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
View
@@ -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

0 comments on commit c0350e3

Please sign in to comment.