mix-rails-videos 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/app/models/video.rb CHANGED
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mix-rails-videos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0
4
+ version: 0.23.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-06 00:00:00.000000000 Z
13
+ date: 2013-02-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -64,6 +64,7 @@ files:
64
64
  - app/views/videos/_video.html.haml
65
65
  - config/locales/videos.pt-BR.yml
66
66
  - config/routes.rb
67
+ - db/migrate/20130208040346_create_videos.rb
67
68
  - lib/tasks/videos_tasks.rake
68
69
  - lib/mix-rails-videos.rb
69
70
  - lib/mix-rails-videos/version.rb
@@ -85,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
86
  version: '0'
86
87
  segments:
87
88
  - 0
88
- hash: 2894587033880359406
89
+ hash: 2727115453069291180
89
90
  required_rubygems_version: !ruby/object:Gem::Requirement
90
91
  none: false
91
92
  requirements:
@@ -94,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  version: '0'
95
96
  segments:
96
97
  - 0
97
- hash: 2894587033880359406
98
+ hash: 2727115453069291180
98
99
  requirements: []
99
100
  rubyforge_project:
100
101
  rubygems_version: 1.8.24