refinerycms-tip-of-the-day 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,5 +2,9 @@ class Tip < ActiveRecord::Base
2
2
  acts_as_indexed :fields => [:title]
3
3
  validates_presence_of :title
4
4
  validates_presence_of :content
5
-
5
+
6
+ def self.tip_of_the_day
7
+ offset = (Date.today.year + Date.today.day) % Tip.count
8
+ return Tip.find(:first,:offset => offset,:conditions => {:published => true}) rescue nil
9
+ end
6
10
  end
@@ -3,7 +3,7 @@ class CreateTips < ActiveRecord::Migration
3
3
  create_table :tips do |t|
4
4
  t.string :title
5
5
  t.text :content
6
- t.boolean :published
6
+ t.boolean :published, :default => true
7
7
  t.timestamps
8
8
  end
9
9
  add_index :tips, :id
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jonathan Baughn