mix-rails-songs 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
data/app/models/song.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mix-rails-songs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- app/views/songs/player.haml
|
46
46
|
- config/locales/songs.pt-BR.yml
|
47
47
|
- config/routes.rb
|
48
|
+
- db/migrate/20130208034029_create_songs.rb
|
48
49
|
- lib/tasks/songs_tasks.rake
|
49
50
|
- lib/mix-rails-songs/version.rb
|
50
51
|
- lib/mix-rails-songs/engine.rb
|
@@ -66,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
67
|
version: '0'
|
67
68
|
segments:
|
68
69
|
- 0
|
69
|
-
hash:
|
70
|
+
hash: 1925582874193756543
|
70
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
72
|
none: false
|
72
73
|
requirements:
|
@@ -75,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
76
|
version: '0'
|
76
77
|
segments:
|
77
78
|
- 0
|
78
|
-
hash:
|
79
|
+
hash: 1925582874193756543
|
79
80
|
requirements: []
|
80
81
|
rubyforge_project:
|
81
82
|
rubygems_version: 1.8.24
|