mix-rails 0.22.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/MIX_RAILS_VERSION +1 -1
  2. data/README.md +4 -13
  3. data/admix/app/controllers/admix/inherited_controller.rb +13 -1
  4. data/admix/lib/admix/version.rb +1 -1
  5. data/admix/spec/spec_helper.rb +3 -7
  6. data/lib/mix-rails.rb +1 -0
  7. data/mix-rails-albums/Gemfile +0 -8
  8. data/mix-rails-albums/app/assets/javascripts/backbone/models/photo.js.coffee +0 -1
  9. data/mix-rails-albums/app/assets/javascripts/backbone/templates/photos/photo_modal_edit.hamlc.erb +2 -2
  10. data/mix-rails-albums/app/assets/javascripts/models/fileitem.js +0 -1
  11. data/mix-rails-albums/app/models/admix/albums_datagrid.rb +1 -1
  12. data/mix-rails-albums/app/models/admix/photos_datagrid.rb +1 -1
  13. data/mix-rails-albums/app/models/album.rb +3 -3
  14. data/mix-rails-albums/app/models/concerns/album.rb +36 -0
  15. data/mix-rails-albums/app/models/photo.rb +7 -8
  16. data/mix-rails-albums/app/uploaders/albums/image_uploader.rb +4 -3
  17. data/mix-rails-albums/db/migrate/20130208020540_create_albums.rb +17 -0
  18. data/mix-rails-albums/db/migrate/20130208021030_create_photos.rb +15 -0
  19. data/mix-rails-albums/lib/mix-rails-albums.rb +1 -7
  20. data/mix-rails-albums/lib/mix-rails-albums/engine.rb +5 -0
  21. data/mix-rails-albums/lib/mix-rails-albums/version.rb +1 -1
  22. data/mix-rails-albums/mix-rails-albums.gemspec +0 -3
  23. data/mix-rails-albums/spec/models/album_spec.rb +5 -0
  24. data/mix-rails-albums/spec/models/picture_spec.rb +5 -0
  25. data/mix-rails-auth/Gemfile +0 -1
  26. data/mix-rails-auth/app/models/admix/roles_datagrid.rb +1 -1
  27. data/mix-rails-auth/app/models/admix/users_datagrid.rb +1 -1
  28. data/mix-rails-auth/app/models/role.rb +2 -15
  29. data/mix-rails-auth/app/models/user.rb +6 -46
  30. data/mix-rails-auth/config/initializers/devise.rb +2 -2
  31. data/mix-rails-auth/config/initializers/rolify.rb +1 -1
  32. data/mix-rails-auth/config/routes.rb +1 -1
  33. data/mix-rails-auth/db/migrate/20130206200605_devise_create_users.rb +46 -0
  34. data/mix-rails-auth/db/migrate/20130206200717_rolify_create_roles.rb +19 -0
  35. data/mix-rails-auth/lib/mix-rails-auth/engine.rb +6 -0
  36. data/mix-rails-auth/lib/mix-rails-auth/version.rb +1 -1
  37. data/mix-rails-auth/spec/models/user_spec.rb +5 -0
  38. data/mix-rails-core/Gemfile +1 -7
  39. data/mix-rails-core/app/models/admix/categories_datagrid.rb +1 -2
  40. data/mix-rails-core/app/models/attachment.rb +4 -3
  41. data/mix-rails-core/app/models/categorization.rb +5 -0
  42. data/mix-rails-core/app/models/category.rb +3 -2
  43. data/mix-rails-core/app/models/concerns/attachment.rb +0 -3
  44. data/mix-rails-core/app/uploaders/core/file_uploader.rb +1 -3
  45. data/mix-rails-core/config/initializers/carrierwave.rb +1 -5
  46. data/mix-rails-core/config/initializers/defaults_rails.rb +1 -0
  47. data/mix-rails-core/config/locales/core.pt-BR.yml +2 -1
  48. data/mix-rails-core/config/routes.rb +0 -2
  49. data/mix-rails-core/db/migrate/20130206195145_create_attachments.rb +10 -0
  50. data/mix-rails-core/db/migrate/20130206195329_create_categories.rb +8 -0
  51. data/mix-rails-core/db/migrate/20130207132351_create_categorizations.rb +9 -0
  52. data/mix-rails-core/lib/mix-rails-core.rb +3 -22
  53. data/mix-rails-core/lib/mix-rails-core/engine.rb +2 -4
  54. data/mix-rails-core/lib/mix-rails-core/version.rb +1 -1
  55. data/mix-rails-core/mix-rails-core.gemspec +1 -6
  56. data/mix-rails-core/spec/models/attachment_spec.rb +5 -0
  57. data/mix-rails-core/spec/models/categorization_spec.rb +5 -0
  58. data/mix-rails-core/spec/models/category_spec.rb +5 -0
  59. data/mix-rails-core/spec/spec_helper.rb +3 -3
  60. data/mix-rails-message-board/app/controllers/admix/board_messages_controller.rb +2 -2
  61. data/mix-rails-message-board/app/controllers/board_messages_controller.rb +1 -1
  62. data/mix-rails-message-board/app/models/admix/board_messages_datagrid.rb +3 -3
  63. data/mix-rails-message-board/app/models/admix/board_replies_datagrid.rb +3 -3
  64. data/mix-rails-message-board/app/models/board_message.rb +12 -21
  65. data/mix-rails-message-board/app/models/board_reply.rb +19 -20
  66. data/mix-rails-message-board/app/views/admix/board_messages/_form_fields.html.haml +1 -1
  67. data/mix-rails-message-board/app/views/admix/board_messages/_show.html.haml +4 -4
  68. data/mix-rails-message-board/app/views/admix/board_messages/_table_actions.html.haml +2 -2
  69. data/mix-rails-message-board/app/views/admix/board_replies/_form_fields.html.haml +1 -1
  70. data/mix-rails-message-board/app/views/admix/board_replies/_show.html.haml +2 -2
  71. data/mix-rails-message-board/app/views/admix/board_replies/_table_actions.html.haml +2 -2
  72. data/mix-rails-message-board/app/views/board_messages/_board_message.html.haml +1 -1
  73. data/mix-rails-message-board/config/locales/message-board.pt-BR.yml +6 -1
  74. data/mix-rails-message-board/db/migrate/20130208130406_create_board_messages.rb +13 -0
  75. data/mix-rails-message-board/db/migrate/20130208130716_create_board_replies.rb +14 -0
  76. data/mix-rails-message-board/lib/mix-rails-message-board/version.rb +1 -1
  77. data/mix-rails-settings/Gemfile +1 -0
  78. data/mix-rails-settings/app/models/admix/settings_datagrid.rb +1 -1
  79. data/mix-rails-settings/app/models/setting.rb +11 -18
  80. data/mix-rails-settings/app/uploaders/settings/image_uploader.rb +2 -3
  81. data/mix-rails-settings/db/migrate/20130206201915_create_settings.rb +13 -0
  82. data/mix-rails-settings/db/migrate/20130206212203_add_image_to_setting.rb +5 -0
  83. data/mix-rails-settings/lib/mix-rails-settings/engine.rb +5 -0
  84. data/mix-rails-settings/lib/mix-rails-settings/version.rb +1 -1
  85. data/mix-rails-settings/spec/models/setting_spec.rb +5 -0
  86. data/mix-rails-songs/app/models/admix/songs_datagrid.rb +1 -1
  87. data/mix-rails-songs/app/models/song.rb +9 -9
  88. data/mix-rails-songs/app/uploaders/songs/song_uploader.rb +2 -2
  89. data/mix-rails-songs/db/migrate/20130208034029_create_songs.rb +14 -0
  90. data/mix-rails-songs/lib/mix-rails-songs/engine.rb +5 -0
  91. data/mix-rails-songs/lib/mix-rails-songs/version.rb +1 -1
  92. data/mix-rails-videos/app/models/video.rb +8 -21
  93. data/mix-rails-videos/db/migrate/20130208040346_create_videos.rb +21 -0
  94. data/mix-rails-videos/lib/mix-rails-videos/version.rb +1 -1
  95. data/mix-rails-vouchers/Gemfile +0 -2
  96. data/mix-rails-vouchers/app/models/admix/vouchers_datagrid.rb +1 -1
  97. data/mix-rails-vouchers/app/models/voucher.rb +10 -14
  98. data/mix-rails-vouchers/app/models/voucher_user.rb +41 -46
  99. data/mix-rails-vouchers/app/uploaders/vouchers/photo_uploader.rb +2 -2
  100. data/mix-rails-vouchers/db/migrate/20130208143458_create_vouchers.rb +15 -0
  101. data/mix-rails-vouchers/db/migrate/20130208143613_create_voucher_users.rb +13 -0
  102. data/mix-rails-vouchers/lib/mix-rails-vouchers.rb +0 -1
  103. data/mix-rails-vouchers/lib/mix-rails-vouchers/version.rb +1 -1
  104. data/mix-rails-vouchers/mix-rails-vouchers.gemspec +0 -1
  105. data/mix-rails-wireframe/lib/mix-rails-wireframe/version.rb +1 -1
  106. data/mix-rails-writer/app/controllers/news_controller.rb +2 -2
  107. data/mix-rails-writer/app/models/admix/news_datagrid.rb +3 -7
  108. data/mix-rails-writer/app/models/news.rb +0 -1
  109. data/mix-rails-writer/app/models/post.rb +10 -19
  110. data/mix-rails-writer/app/uploaders/writer/image_uploader.rb +2 -2
  111. data/mix-rails-writer/app/views/admix/posts/_form_fields.html.haml +2 -2
  112. data/mix-rails-writer/app/views/admix/posts/_show.html.haml +2 -2
  113. data/mix-rails-writer/db/migrate/20130208042530_create_posts.rb +16 -0
  114. data/mix-rails-writer/lib/mix-rails-writer/engine.rb +5 -0
  115. data/mix-rails-writer/lib/mix-rails-writer/version.rb +1 -1
  116. data/mix-rails.gemspec +12 -11
  117. data/version.rb +1 -1
  118. metadata +92 -56
  119. data/mix-rails-albums/lib/concerns/models/album.rb +0 -43
  120. data/mix-rails-core/app/controllers/gridfs_controller.rb +0 -31
  121. data/mix-rails-core/config/initializers/mongoid.rb +0 -1
  122. data/mix-rails-core/lib/mix-rails-core/gridfs.rb +0 -32
  123. data/mix-rails-vouchers/test/functional/voucher_mailer_test.rb +0 -7
@@ -1,13 +1,11 @@
1
- class Song
2
-
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
1
+ class Song < ActiveRecord::Base
5
2
  extend Enumerize
3
+ extend FriendlyId
4
+
5
+ attr_accessible :author, :mp3, :slug, :status, :title
6
6
 
7
- field :title, type: String
8
- field :author, type: String
9
- field :status, type: String
10
7
  enumerize :status, in: [:published, :unpublished], default: :published, predicates: true
8
+ friendly_id :title, use: :slugged
11
9
 
12
10
  mount_uploader :mp3, Songs::SongUploader
13
11
 
@@ -15,5 +13,7 @@ class Song
15
13
  validates_presence_of :author
16
14
 
17
15
  scope :published, where(status: :published)
18
-
19
- end
16
+
17
+ belongs_to :related, polymorphic: true
18
+
19
+ end
@@ -12,13 +12,13 @@ class Songs::SongUploader < CarrierWave::Uploader::Base
12
12
  include Sprockets::Helpers::IsolatedHelper
13
13
 
14
14
  # Choose what kind of storage to use for this uploader:
15
- storage :grid_fs
15
+
16
16
  # storage :fog
17
17
 
18
18
  # Override the directory where uploaded files will be stored.
19
19
  # This is a sensible default for uploaders that are meant to be mounted:
20
20
  def store_dir
21
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
21
+ "system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
22
22
  end
23
23
 
24
24
  def cache_dir
@@ -0,0 +1,14 @@
1
+ class CreateSongs < ActiveRecord::Migration
2
+ def change
3
+ create_table :songs do |t|
4
+ t.string :title
5
+ t.string :author
6
+ t.string :status
7
+ t.string :mp3
8
+ t.string :slug
9
+
10
+ t.references :related, polymorphic: true
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -1,6 +1,11 @@
1
1
  module MixRailsSongs
2
2
  class Engine < ::Rails::Engine
3
3
 
4
+ config.generators do |g|
5
+ g.test_framework :rspec
6
+ g.integration_tool :rspec
7
+ end
8
+
4
9
  def navigation
5
10
  if defined? Admix
6
11
  Admix::Navigation::NavBar.post_menu do
@@ -1,7 +1,7 @@
1
1
  module MixRailsSongs
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 22
4
+ MINOR = 23
5
5
  TINY = 0
6
6
  PRE = nil
7
7
 
@@ -1,31 +1,18 @@
1
- class Video
2
- include Mongoid::Document
3
- include Mongoid::Timestamps
4
- include Mongoid::Slug
1
+ class Video < ActiveRecord::Base
2
+ extend FriendlyId
5
3
 
6
- scope :most_recent, order_by(published_at: -1, name: 1)
7
-
8
- field :url, type: String
9
- field :title, type: String
10
- field :description, type: String
11
- field :title, type: String
12
- field :likes, type: Integer
13
- field :dislikes, type: Integer
14
- field :views, type: Integer
15
- field :youtube_code, type: String
16
- field :published_at, type: Time
17
- field :seconds, type: Integer
18
- field :category, type: String
19
- field :active, type: Boolean, default: true
4
+ attr_accessible :active, :category, :description, :dislikes, :likes, :published_at, :seconds, :title, :url, :views, :youtube_code
5
+
6
+ friendly_id :title, use: :slugged
20
7
 
21
8
  validates :url, presence: true, youtube: true
22
9
 
23
- slug :title, history: true do |video|
24
- video.title.parameterize
25
- end
10
+ belongs_to :related, polymorphic: true
26
11
 
27
12
  after_validation :insert_youtube_data
28
13
 
14
+ scope :most_recent, order('published_at DESC, title ASC')
15
+
29
16
  def insert_youtube_data
30
17
  if self.errors.blank?
31
18
  yt_code = self.extract_youtube_code
@@ -0,0 +1,21 @@
1
+ class CreateVideos < ActiveRecord::Migration
2
+ def change
3
+ create_table :videos do |t|
4
+ t.string :title
5
+ t.string :url
6
+ t.string :description
7
+ t.integer :likes
8
+ t.integer :dislikes
9
+ t.integer :views
10
+ t.string :youtube_code
11
+ t.datetime :published_at
12
+ t.integer :seconds
13
+ t.string :category
14
+ t.boolean :active
15
+ t.string :slug
16
+
17
+ t.references :related, polymorphic: true
18
+ t.timestamps
19
+ end
20
+ end
21
+ end
@@ -1,7 +1,7 @@
1
1
  module MixRailsVideos
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 22
4
+ MINOR = 23
5
5
  TINY = 0
6
6
  PRE = nil
7
7
 
@@ -1,7 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'carrierwave-mongoid', '~> 0.3.0', :require => 'carrierwave/mongoid'
4
-
5
3
  # Declare your gem's dependencies in mix-vouchers.gemspec.
6
4
  # Bundler will treat runtime dependencies like base dependencies, and
7
5
  # development dependencies will be added by default to the :development group.
@@ -2,7 +2,7 @@ class Admix::VouchersDatagrid
2
2
  include Datagrid
3
3
 
4
4
  scope do
5
- Voucher.all
5
+ Voucher
6
6
  end
7
7
  column :name, header: I18n.t('vouchers.fields.name')
8
8
 
@@ -1,22 +1,18 @@
1
- class Voucher
2
- include Mongoid::Document
3
- include Mongoid::Timestamps
4
- include Mongoid::Slug
1
+ class Voucher < ActiveRecord::Base
2
+ extend FriendlyId
5
3
 
6
- scope :actives, -> { where({:date_from.lte => Date.today, :date_to.gte => Date.today}) }
4
+ attr_accessible :date_from, :date_to, :name, :partner_photo, :photo, :rules
5
+ attr_accessible :photo_cache, :partner_photo_cache
6
+
7
+ scope :actives, -> { where("date_from <= ? and date_to >= ?", Date.today, Date.today) }
8
+
9
+ has_many :users, class_name: 'VoucherUser', dependent: :delete_all
7
10
 
8
- field :name, type: String
9
- field :rules, type: Array
10
- field :date_from, type: Date
11
- field :date_to, type: Date
12
11
  mount_uploader :photo, Vouchers::PhotoUploader
13
12
  mount_uploader :partner_photo, Vouchers::PhotoUploader
14
13
 
15
- has_many :users, class_name: 'VoucherUser', dependent: :delete
16
-
17
14
  validates_presence_of :name, :rules, :photo
18
15
 
19
- slug :name, history: true do |voucher|
20
- voucher.name.parameterize
21
- end
16
+ friendly_id :name, use: :slugged
17
+
22
18
  end
@@ -1,48 +1,43 @@
1
- class VoucherUser
2
- include Mongoid::Document
3
- include Mongoid::Timestamps
4
-
5
- field :name, type: String
6
- field :email, type: String
7
- field :confirmed, type: Boolean, default: false
8
- field :confirmation_date, type: Date
9
-
10
- belongs_to :voucher
11
-
12
- attr_protected :confirmed, :confirmation_date
13
- validates_presence_of :name, :email
14
- validates :email, email: true
15
-
16
- after_create :send_confirmation_email
17
-
18
-
19
- def confirm
20
- @confirmed = true
21
- @confirmation_date = Time.now
22
- @save
23
- end
24
-
25
- # @param voucher instance of Voucher
26
- def already_required(voucher)
27
- user = VoucherUser.where({voucher_id: voucher[:_id], _id: @attributes['_id']}).first
28
- if user
29
- true
30
- else
31
- false
32
- end
33
- end
34
-
35
- def has_confirmed(voucher)
36
- user = VoucherUser.where({voucher_id: voucher[:_id], _id: @attributes['_id'], confirmed: true}).first
37
- if user
38
- true
39
- else
40
- false
41
- end
42
- end
43
-
44
- def send_confirmation_email
45
- VoucherMailer.send_confirmation_link(self).deliver
46
- end
1
+ class VoucherUser < ActiveRecord::Base
2
+ attr_accessible :confirmation_date, :confirmed, :email, :name
3
+
4
+ belongs_to :voucher
5
+
6
+ attr_protected :confirmed, :confirmation_date
7
+ validates_presence_of :name, :email
8
+ validates :email, email: true
9
+
10
+ after_create :send_confirmation_email
11
+
12
+
13
+ def confirm
14
+ @confirmed = true
15
+ @confirmation_date = Time.now
16
+ @save
17
+ end
18
+
19
+ # @param voucher instance of Voucher
20
+ def already_required(voucher)
21
+ user = VoucherUser.where({voucher_id: voucher[:id], id: @attributes['id']}).first
22
+ if user
23
+ true
24
+ else
25
+ false
26
+ end
27
+ end
28
+
29
+ def has_confirmed(voucher)
30
+ user = VoucherUser.where({voucher_id: voucher[:id], id: @attributes['id'], confirmed: true}).first
31
+ if user
32
+ true
33
+ else
34
+ false
35
+ end
36
+ end
37
+
38
+ def send_confirmation_email
39
+ VoucherMailer.send_confirmation_link(self).deliver
40
+ end
41
+
47
42
 
48
43
  end
@@ -15,13 +15,13 @@ class Vouchers::PhotoUploader < CarrierWave::Uploader::Base
15
15
  # include Sprockets::Helpers::IsolatedHelper
16
16
 
17
17
  # Choose what kind of storage to use for this uploader:
18
- storage :grid_fs
18
+
19
19
  # storage :fog
20
20
 
21
21
  # Override the directory where uploaded files will be stored.
22
22
  # This is a sensible default for uploaders that are meant to be mounted:
23
23
  def store_dir
24
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
24
+ "system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
25
25
  end
26
26
 
27
27
  def cache_dir
@@ -0,0 +1,15 @@
1
+ class CreateVouchers < ActiveRecord::Migration
2
+ def change
3
+ create_table :vouchers do |t|
4
+ t.string :name
5
+ t.text :rules
6
+ t.date :date_from
7
+ t.date :date_to
8
+ t.string :photo
9
+ t.string :partner_photo
10
+ t.string :slug
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ class CreateVoucherUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :voucher_users do |t|
4
+ t.string :name
5
+ t.string :email
6
+ t.boolean :confirmed
7
+ t.date :confirmation_date
8
+
9
+ t.references :voucher
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,4 @@
1
1
  require "mix-rails-vouchers/engine"
2
- require "carrierwave/mongoid"
3
2
 
4
3
  module MixRailsVouchers
5
4
  end
@@ -1,7 +1,7 @@
1
1
  module MixRailsVouchers
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 22
4
+ MINOR = 23
5
5
  TINY = 0
6
6
  PRE = nil
7
7
 
@@ -17,5 +17,4 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.add_dependency 'mail_form', '~> 1.4.0'
19
19
  s.add_dependency "rails", "~> 3.2.9"
20
- s.add_dependency 'carrierwave-mongoid', '~> 0.3.0'
21
20
  end
@@ -1,7 +1,7 @@
1
1
  module MixRailsWireframe
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 22
4
+ MINOR = 23
5
5
  TINY = 0
6
6
  PRE = nil
7
7
 
@@ -2,12 +2,12 @@ class NewsController < PostsController
2
2
 
3
3
 
4
4
  def index
5
- @news = News.published.desc(:date).paginate(per_page: 10)
5
+ @news = News.published.order('date DESC').paginate(page: params[:page],per_page: 10)
6
6
  end
7
7
 
8
8
  def show
9
9
  @news = News.find(params[:id])
10
- @other_news = News.published.not_in(:id => @news.id).desc(:date).paginate(per_page: 10)
10
+ @other_news = News.published.not_in(:id => @news.id).order('date DESC').paginate(page: params[:page], per_page: 10)
11
11
  end
12
12
 
13
13
  end
@@ -4,7 +4,7 @@ class Admix::NewsDatagrid
4
4
 
5
5
 
6
6
  scope do
7
- News.desc(:date)
7
+ News.order('id DESC')
8
8
  end
9
9
 
10
10
  filter :date do |value|
@@ -24,12 +24,8 @@ class Admix::NewsDatagrid
24
24
  end
25
25
  end
26
26
 
27
- column :published, header: I18n.t('posts.published') do |post|
28
- if post.published
29
- I18n.t("posts.published_yes")
30
- else
31
- I18n.t("posts.published_no")
32
- end
27
+ column :status, header: I18n.t('posts.status') do |post|
28
+ post.status.text
33
29
  end
34
30
 
35
31
 
@@ -1,3 +1,2 @@
1
1
  class News < Post
2
-
3
2
  end
@@ -1,26 +1,17 @@
1
- class Post
2
-
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
- include Mongoid::Paranoia
6
- include Mongoid::Slug
1
+ class Post < ActiveRecord::Base
2
+ extend Enumerize
3
+ extend FriendlyId
7
4
 
8
- field :title, type: String
9
- field :text, type: String
10
- field :source, type: String
11
- field :date, type: DateTime
12
- field :published, type: Boolean, default: true
5
+ attr_accessible :content, :date, :slug, :source, :status, :title, :type, :image, :image_cache
6
+ friendly_id :title, use: :slugged
7
+ enumerize :status, in: [:published, :unpublished], default: :published, predicates: true
13
8
 
14
9
 
15
- validates_presence_of :title
16
- validates_presence_of :date
10
+ validates_presence_of :title, :date
17
11
 
18
- slug :title, history: true do |current_object|
19
- current_object.title.parameterize
20
- end
21
12
 
22
- scope :published, where(published: true)
13
+ scope :published, where(status: :published)
23
14
 
24
15
  mount_uploader :image, Writer::ImageUploader
25
-
26
- end
16
+
17
+ end