Skip to content

Commit

Permalink
Use ApplicationRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiIto committed Jul 7, 2016
1 parent a85038e commit 1f6e79c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions app/models/application_record.rb
@@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
2 changes: 1 addition & 1 deletion app/models/contact.rb
@@ -1,4 +1,4 @@
class Contact < ActiveRecord::Base
class Contact < ApplicationRecord
has_many :phones
accepts_nested_attributes_for :phones

Expand Down
2 changes: 1 addition & 1 deletion app/models/news_release.rb
@@ -1,4 +1,4 @@
class NewsRelease < ActiveRecord::Base
class NewsRelease < ApplicationRecord
validates :released_on, presence: true
validates :title, presence: true
validates :body, presence: true
Expand Down
2 changes: 1 addition & 1 deletion app/models/phone.rb
@@ -1,4 +1,4 @@
class Phone < ActiveRecord::Base
class Phone < ApplicationRecord
belongs_to :contact

validates :phone, uniqueness: { scope: :contact_id }
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
@@ -1,4 +1,4 @@
class User < ActiveRecord::Base
class User < ApplicationRecord
has_secure_password

validates :email, presence: true, uniqueness: true
Expand Down

0 comments on commit 1f6e79c

Please sign in to comment.