Skip to content

Commit b60dc28

Browse files
author
David Personette
committed
Update to activerecord 5
1 parent d0a7f98 commit b60dc28

30 files changed

Lines changed: 50 additions & 41 deletions

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ group :development, :test do
2525
gem "timecop", "~> 0.8"
2626
end
2727

28-
gem "activerecord", "~> 4.2.6"
28+
gem "activerecord", "~> 5.0"
2929
gem "bcrypt", "~> 3.1"
3030
gem "delayed_job", "~> 4.1"
3131
gem "delayed_job_active_record", "~> 4.1"

Gemfile.lock

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
activemodel (4.2.10)
5-
activesupport (= 4.2.10)
6-
builder (~> 3.1)
7-
activerecord (4.2.10)
8-
activemodel (= 4.2.10)
9-
activesupport (= 4.2.10)
10-
arel (~> 6.0)
11-
activesupport (4.2.10)
12-
i18n (~> 0.7)
4+
activemodel (5.2.4.5)
5+
activesupport (= 5.2.4.5)
6+
activerecord (5.2.4.5)
7+
activemodel (= 5.2.4.5)
8+
activesupport (= 5.2.4.5)
9+
arel (>= 9.0)
10+
activesupport (5.2.4.5)
11+
concurrent-ruby (~> 1.0, >= 1.0.2)
12+
i18n (>= 0.7, < 2)
1313
minitest (~> 5.1)
14-
thread_safe (~> 0.3, >= 0.3.4)
1514
tzinfo (~> 1.1)
1615
addressable (2.4.0)
17-
arel (6.0.4)
16+
arel (9.0.0)
1817
ast (2.4.0)
1918
backports (3.6.8)
2019
bcrypt (3.1.11)
@@ -187,7 +186,7 @@ PLATFORMS
187186
ruby
188187

189188
DEPENDENCIES
190-
activerecord (~> 4.2.6)
189+
activerecord (~> 5.0)
191190
bcrypt (~> 3.1)
192191
capybara (~> 2.6)
193192
coveralls (~> 0.7)

app/models/application_record.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationRecord < ActiveRecord::Base
2+
self.abstract_class = true
3+
end

app/models/feed.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
class Feed < ActiveRecord::Base
1+
require_relative "./application_record"
2+
3+
class Feed < ApplicationRecord
24
has_many :stories, -> { order "published desc" }, dependent: :delete_all
35
belongs_to :group
46

app/models/group.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
class Group < ActiveRecord::Base
1+
require_relative "./application_record"
2+
3+
class Group < ApplicationRecord
24
has_many :feeds
35

46
def as_fever_json

app/models/story.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
require_relative "./application_record"
12
require_relative "./feed"
23

3-
class Story < ActiveRecord::Base
4+
class Story < ApplicationRecord
45
belongs_to :feed
56

67
validates_uniqueness_of :entry_id, scope: :feed_id

app/models/user.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
class User < ActiveRecord::Base
1+
require_relative "./application_record"
2+
3+
class User < ApplicationRecord
24
has_secure_password
35
end

db/migrate/20130409010818_create_feeds.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class CreateFeeds < ActiveRecord::Migration
1+
class CreateFeeds < ActiveRecord::Migration[4.2]
22
def change
33
create_table :feeds do |t|
44
t.string :name

db/migrate/20130409010826_create_stories.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class CreateStories < ActiveRecord::Migration
1+
class CreateStories < ActiveRecord::Migration[4.2]
22
def change
33
create_table :stories do |t|
44
t.string :title

db/migrate/20130412185253_add_new_fields_to_stories.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class AddNewFieldsToStories < ActiveRecord::Migration
1+
class AddNewFieldsToStories < ActiveRecord::Migration[4.2]
22
def change
33
add_column :stories, :published, :timestamp
44
add_column :stories, :is_read, :boolean

0 commit comments

Comments
 (0)