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
data/MIX_RAILS_VERSION CHANGED
@@ -1 +1 @@
1
- 0.22.0
1
+ 0.23.0
data/README.md CHANGED
@@ -3,14 +3,14 @@
3
3
  [![Build Status](https://travis-ci.org/mixinternet/mix-rails.png)](https://travis-ci.org/mixinternet/mix-rails)
4
4
  [![Dependency Status](https://gemnasium.com/mixinternet/mix-rails.png)](https://gemnasium.com/mixinternet/mix-rails)
5
5
 
6
- MixRails is a CMS based on Ruby on Rails and uses Mongoid as ORM(MongoDB).
6
+ MixRails is a CMS based on Ruby on Rails.
7
7
 
8
8
 
9
9
  ## Usage
10
10
 
11
11
  Create a new rails project.
12
12
 
13
- $ rails new myproject -T --skip-active-record --skip-bundle --dummy-path=spec/dummy
13
+ $ rails new myproject -T --skip-bundle --dummy-path=spec/dummy
14
14
 
15
15
  Add this line to your application's Gemfile:
16
16
 
@@ -25,20 +25,11 @@ And then execute:
25
25
  In your config/application.rb add require 'mix-rails/all'.
26
26
 
27
27
  ```ruby
28
- require "action_controller/railtie"
29
- require "action_mailer/railtie"
30
- require "active_resource/railtie"
31
- require "sprockets/railtie"
32
- require "rails/test_unit/railtie"
33
-
28
+ require 'rails/all'
34
29
  # After rails requiring mix-rails!!
35
30
  require "mix-rails/all"
36
31
  ```
37
32
 
38
- Configure a mongoid instance with:
39
-
40
- $ rails generate mongoid:config
41
-
42
33
  And then run the application
43
34
 
44
35
  $ bundle exec rails server
@@ -84,5 +75,5 @@ TODO: Add some docs for admix
84
75
 
85
76
  ## Creating a extension
86
77
 
87
- $ rails plugin new mix-rails-pluginame -T --skip-active-record --skip-bundle --dummy-path=spec/dummy --full
78
+ $ rails plugin new mix-rails-pluginame -T --skip-bundle --dummy-path=spec/dummy --full
88
79
  s
@@ -1,11 +1,23 @@
1
1
  module Admix
2
2
  class InheritedController < Admix::AdmixController
3
+ helper :all
3
4
 
4
5
  inherit_resources
6
+ include InheritedResources::DSL
7
+
8
+ rescue_from ActiveRecord::DeleteRestrictionError do |exception|
9
+ #resource.errors.add(:base, exception)
10
+ flash[:alert] = I18n.t('errors.dependent')
11
+ redirect_to collection_url
12
+ end
13
+
14
+ # destroy! do |success, failure|
15
+ # failure.html { redirect_to polymorphic_path(resource) }
16
+ # end
5
17
 
6
18
  # TODO: Add authorization here.
7
19
 
8
- helper :all
20
+
9
21
 
10
22
  before_filter :generate_datagrid , only: [:index ]
11
23
 
@@ -1,7 +1,7 @@
1
1
  module Admix
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
 
@@ -39,20 +39,16 @@ RSpec.configure do |config|
39
39
  # --seed 1234
40
40
  config.order = "random"
41
41
 
42
-
43
- #DatabaseCleaner.orm = "mongoid"
44
- #DatabaseCleaner.strategy = :truncation
45
-
46
42
  config.before(:suite) do
47
- DatabaseCleaner[:mongoid].strategy = :truncation
43
+ DatabaseCleaner.strategy = :truncation
48
44
  end
49
45
 
50
46
  config.before(:each) do
51
- DatabaseCleaner[:mongoid].start
47
+ DatabaseCleaner.start
52
48
  end
53
49
 
54
50
  config.after(:each) do
55
- DatabaseCleaner[:mongoid].clean
51
+ DatabaseCleaner.clean
56
52
  end
57
53
 
58
54
  end
data/lib/mix-rails.rb CHANGED
@@ -1,2 +1,3 @@
1
+ autoload :FriendlyId, 'friendly_id'
1
2
  module MixRails
2
3
  end
@@ -12,14 +12,6 @@ end
12
12
  # jquery-rails is used by the dummy application
13
13
  gem "jquery-rails"
14
14
  gem "haml-rails"
15
- gem 'bson_ext'
16
- gem 'mongo'
17
-
18
- # gem 'carrierwave'
19
- # gem 'carrierwave-mongoid', require: 'carrierwave/mongoid'
20
- # gem 'mini_magick'
21
- #
22
- gem "carrierwave-mongoid", :git => "git://github.com/jnicklas/carrierwave-mongoid.git", :branch => "master"
23
15
  gem 'mini_magick', :git => 'git://github.com/probablycorey/mini_magick.git'
24
16
 
25
17
  # Declare any dependencies that are still in development here instead of in
@@ -1,6 +1,5 @@
1
1
  class Application.Models.Photo extends Backbone.Model
2
2
  paramRoot: 'photo'
3
- idAttribute: '_id'
4
3
  defaults:
5
4
  image: null
6
5
  description: ''
@@ -1,10 +1,10 @@
1
- .modal.hide.fade.admix-photo-modal{id: "photo-modal-#{@_id}"}
1
+ .modal.hide.fade.admix-photo-modal{id: "photo-modal-#{@id}"}
2
2
  .modal-header
3
3
  %button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} ×
4
4
  %h3 Detalhes da foto
5
5
  .modal-body
6
6
  .edit-area.pull-right
7
- %textarea.span5{id: "input_photo_description_#{@_id}",placeholder: 'Adicione uma descrição para esta foto.'}
7
+ %textarea.span5{id: "input_photo_description_#{@id}",placeholder: 'Adicione uma descrição para esta foto.'}
8
8
  #{@description}
9
9
  .photo
10
10
  %img{src: @image.medium.url}
@@ -1,7 +1,6 @@
1
1
  var FileItem = Backbone.Model.extend({
2
2
  name: 'photo',
3
3
  url: 'photos',
4
- idAttribute: '_id',
5
4
  defaults: {
6
5
  progress:0
7
6
  },
@@ -6,7 +6,7 @@ class Admix::AlbumsDatagrid
6
6
 
7
7
 
8
8
  scope do
9
- Album.desc(:date)
9
+ Album.order("date DESC")
10
10
  end
11
11
 
12
12
  filter :title, :string
@@ -3,7 +3,7 @@ class Admix::PhotosDatagrid
3
3
  include Datagrid
4
4
 
5
5
  scope do
6
- Photo.desc(:date)
6
+ Photo
7
7
  end
8
8
 
9
9
  filter :name, :string
@@ -1,3 +1,3 @@
1
- class Album
2
- include MixRailsAlbums::Concerns::Models::Album
3
- end
1
+ class Album < ActiveRecord::Base
2
+ include Concerns::Album
3
+ end
@@ -0,0 +1,36 @@
1
+ module Concerns::Album
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ extend Enumerize
6
+ extend FriendlyId
7
+
8
+ attr_accessible :date, :description, :status, :title
9
+
10
+ enumerize :status, in: [:published, :unpublished], default: :published, predicates: true
11
+ friendly_id :title, use: :slugged
12
+
13
+ has_many :photos, :as => :related
14
+ belongs_to :related, :polymorphic => true
15
+
16
+ validation_for_title
17
+ validation_for_date
18
+
19
+
20
+ scope :published, where(status: :published).joins(:photos).having("count(photos.id) > 1")
21
+
22
+ end
23
+
24
+ module ClassMethods
25
+
26
+ def validation_for_title
27
+ validates_presence_of :title
28
+ end
29
+
30
+ def validation_for_date
31
+ validates_presence_of :date
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -1,12 +1,11 @@
1
- class Photo
2
-
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
1
+ class Photo < ActiveRecord::Base
2
+ extend FriendlyId
5
3
 
6
- field :description
4
+ attr_accessible :description, :image, :image_cache
7
5
 
8
- embedded_in :album
6
+ friendly_id :description, use: :slugged
9
7
 
8
+ belongs_to :related, :polymorphic => true
9
+
10
10
  mount_uploader :image, Albums::ImageUploader
11
-
12
- end
11
+ end
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
  require 'carrierwave/processing/mini_magick'
3
- require 'mix-rails-core/gridfs'
4
3
 
5
4
  class Albums::ImageUploader < CarrierWave::Uploader::Base
6
5
 
@@ -13,13 +12,13 @@ class Albums::ImageUploader < CarrierWave::Uploader::Base
13
12
  include Sprockets::Helpers::IsolatedHelper
14
13
 
15
14
  # Choose what kind of storage to use for this uploader:
16
- storage :grid_fs
15
+
17
16
  # storage :fog
18
17
 
19
18
  # Override the directory where uploaded files will be stored.
20
19
  # This is a sensible default for uploaders that are meant to be mounted:
21
20
  def store_dir
22
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
21
+ "system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
23
22
  end
24
23
 
25
24
  def cache_dir
@@ -51,6 +50,8 @@ class Albums::ImageUploader < CarrierWave::Uploader::Base
51
50
 
52
51
  albums_watermark = Setting.albums_watermark
53
52
 
53
+ #raise albums_watermark.image
54
+
54
55
  watermark_image = if albums_watermark
55
56
  gridfs_file = MixRailsCore::Gridfs::read_file(albums_watermark.image.url)
56
57
  MiniMagick::Image.read(gridfs_file, "png")
@@ -0,0 +1,17 @@
1
+ class CreateAlbums < ActiveRecord::Migration
2
+ def change
3
+ create_table :albums do |t|
4
+ t.string :title
5
+ t.text :description
6
+ t.date :date
7
+ t.string :status
8
+ t.string :slug
9
+
10
+ t.references :related, polymorphic: true
11
+ t.timestamps
12
+ end
13
+
14
+ add_index :albums, :slug, unique: true
15
+
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ class CreatePhotos < ActiveRecord::Migration
2
+ def change
3
+ create_table :photos do |t|
4
+ t.text :description
5
+ t.string :image
6
+ t.string :slug
7
+
8
+ t.references :related, polymorphic: true
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :photos, :slug, unique: true
13
+
14
+ end
15
+ end
@@ -1,9 +1,5 @@
1
1
  require "mix-rails-albums/engine"
2
-
3
- require "mongoid/railtie"
4
- require "carrierwave/mongoid"
5
2
  require "mini_magick"
6
-
7
3
  require "haml_coffee_assets"
8
4
 
9
5
  module MixRailsAlbums
@@ -11,6 +7,4 @@ module MixRailsAlbums
11
7
  module Models
12
8
  end
13
9
  end
14
- end
15
-
16
- require 'concerns/models/album'
10
+ end
@@ -1,6 +1,11 @@
1
1
  module MixRailsAlbums
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 MixRailsAlbums
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
 
@@ -16,9 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
17
17
 
18
18
  s.add_dependency "rails", "~> 3.2.9"
19
- s.add_dependency 'bson_ext'
20
- s.add_dependency 'mongo'
21
- s.add_dependency 'carrierwave-mongoid'
22
19
  s.add_dependency 'mini_magick'
23
20
  s.add_dependency 'haml_coffee_assets'
24
21
 
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Album do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe Picture do
4
+ pending "add some examples to (or delete) #{__FILE__}"
5
+ end
@@ -6,7 +6,6 @@ source "http://rubygems.org"
6
6
  gemspec
7
7
 
8
8
  # jquery-rails is used by the dummy application
9
- gem "mongoid"
10
9
  gem "rolify"
11
10
  gem "jquery-rails"
12
11
  gem "rspec-rails"
@@ -4,7 +4,7 @@ class Admix::RolesDatagrid
4
4
  extend AdmixHelper
5
5
 
6
6
  scope do
7
- Role.all
7
+ Role
8
8
  end
9
9
 
10
10
  column :name, header: input_label(:role, :name)
@@ -3,7 +3,7 @@ class Admix::UsersDatagrid
3
3
  include Datagrid
4
4
 
5
5
  scope do
6
- User.desc(:email)
6
+ User
7
7
  end
8
8
 
9
9
  filter :email, :string
@@ -1,19 +1,6 @@
1
- class Role
2
- include Mongoid::Document
3
-
4
- has_and_belongs_to_many :users
1
+ class Role < ActiveRecord::Base
2
+ has_and_belongs_to_many :users, :join_table => :users_roles
5
3
  belongs_to :resource, :polymorphic => true
6
4
 
7
- field :name, :type => String
8
- index({ :name => 1 }, { :unique => true })
9
-
10
-
11
- index({
12
- :name => 1,
13
- :resource_type => 1,
14
- :resource_id => 1
15
- },
16
- { :unique => true})
17
-
18
5
  scopify
19
6
  end
@@ -1,52 +1,12 @@
1
- class User
2
- include Mongoid::Document
1
+ class User < ActiveRecord::Base
3
2
  rolify
4
- include Authority::UserAbilities
5
-
6
- ROLES = %w[admin manager]
7
-
8
3
  # Include default devise modules. Others available are:
9
4
  # :token_authenticatable, :confirmable,
10
5
  # :lockable, :timeoutable and :omniauthable
11
- devise :database_authenticatable, :recoverable, :rememberable,
12
- :trackable, :validatable, :registerable
13
-
14
- ## Database authenticatable
15
- field :email, :type => String, :default => ""
16
- field :encrypted_password, :type => String, :default => ""
17
-
18
- validates_presence_of :email
19
- validates_presence_of :encrypted_password
20
-
21
- ## Recoverable
22
- field :reset_password_token, :type => String
23
- field :reset_password_sent_at, :type => Time
24
-
25
- ## Rememberable
26
- field :remember_created_at, :type => Time
27
-
28
- ## Trackable
29
- field :sign_in_count, :type => Integer, :default => 0
30
- field :current_sign_in_at, :type => Time
31
- field :last_sign_in_at, :type => Time
32
- field :current_sign_in_ip, :type => String
33
- field :last_sign_in_ip, :type => String
34
-
35
-
36
- ## Confirmable
37
- # field :confirmation_token, :type => String
38
- # field :confirmed_at, :type => Time
39
- # field :confirmation_sent_at, :type => Time
40
- # field :unconfirmed_email, :type => String # Only if using reconfirmable
41
-
42
- ## Lockable
43
- # field :failed_attempts, :type => Integer, :default => 0 # Only if lock strategy is :failed_attempts
44
- # field :unlock_token, :type => String # Only if unlock strategy is :email or :both
45
- # field :locked_at, :type => Time
46
-
47
- ## Token authenticatable
48
- # field :authentication_token, :type => String
49
-
50
- #has_and_belongs_to_many :roles
6
+ devise :database_authenticatable, :registerable,
7
+ :recoverable, :rememberable, :trackable, :validatable
51
8
 
9
+ # Setup accessible (or protected) attributes for your model
10
+ attr_accessible :email, :password, :password_confirmation, :remember_me
11
+ # attr_accessible :title, :body
52
12
  end