Commit a355ea6f17ce89897d2c6496b363e5c77f48919b

Authored by Dmitriy Zaporozhets
1 parent 084bb6b1

Default values gem

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing 3 changed files with 8 additions and 0 deletions   Show diff stats
Gemfile
... ... @@ -15,6 +15,9 @@ gem &#39;rails-observers&#39;
15 15 gem 'actionpack-page_caching'
16 16 gem 'actionpack-action_caching'
17 17  
  18 +# Default values for AR models
  19 +gem "default_value_for", "~> 3.0.0"
  20 +
18 21 # Supported DBs
19 22 gem "mysql2", group: :mysql
20 23 gem "pg", group: :postgres
... ...
Gemfile.lock
... ... @@ -101,6 +101,8 @@ GEM
101 101 daemons (1.1.9)
102 102 database_cleaner (1.2.0)
103 103 debug_inspector (0.0.2)
  104 + default_value_for (3.0.0)
  105 + activerecord (>= 3.2.0, < 5.0)
104 106 descendants_tracker (0.0.3)
105 107 devise (3.0.4)
106 108 bcrypt-ruby (~> 3.0)
... ... @@ -570,6 +572,7 @@ DEPENDENCIES
570 572 coveralls
571 573 d3_rails (~> 3.1.4)
572 574 database_cleaner
  575 + default_value_for (~> 3.0.0)
573 576 devise (= 3.0.4)
574 577 devise-async (= 0.8.0)
575 578 email_spec
... ...
app/models/service.rb
... ... @@ -19,6 +19,8 @@
19 19 # To add new service you should build a class inherited from Service
20 20 # and implement a set of methods
21 21 class Service < ActiveRecord::Base
  22 + default_value_for :active, false
  23 +
22 24 attr_accessible :title, :token, :type, :active, :api_key
23 25  
24 26 belongs_to :project
... ...