ismasan-ar_publish_control 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -100,7 +100,7 @@ Add the necessary fields to you schema, in a migration:
100
100
 
101
101
  class AddPublishableToPosts < ActiveRecord::Migration
102
102
  def self.up
103
- add_column :posts, :is_published, :boolean
103
+ add_column :posts, :is_published, :boolean, :default => true
104
104
  add_column :posts, :publish_at, :datetime
105
105
  add_column :posts, :unpublish_at, :datetime
106
106
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ar_publish_control}
5
- s.version = "0.0.5"
5
+ s.version = "0.0.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ismael Celis"]
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module ArPublishControl
5
- VERSION = '0.0.5'
5
+ VERSION = '0.0.6'
6
6
  # This is a gem version of http://github.com/avdgaag/acts_as_publishable ( a Rails plugin)
7
7
  # Thanks to Avdaag for his awesome, super readable code which I ripped off for this gem.
8
8
  #
@@ -101,6 +101,7 @@ module ArPublishControl
101
101
  bool ? {:conditions => published_conditions} : {}
102
102
  }
103
103
  before_validation :init_publish_date # don't allow empty publish_at
104
+ validate :validate_publish_date_consistency
104
105
  before_create :publish_by_default if options[:publish_by_default]
105
106
  end
106
107
 
@@ -163,7 +164,7 @@ module ArPublishControl
163
164
 
164
165
  # Validate that unpublish_at is greater than publish_at
165
166
  # publish_at must not be nil
166
- def validate
167
+ def validate_publish_date_consistency
167
168
  if unpublish_at && publish_at && unpublish_at <= publish_at
168
169
  errors.add(:unpublish_at,"should be greater than publication date or empty")
169
170
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ismasan-ar_publish_control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis