drafts 0.0.4 → 0.0.5

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.
@@ -1,4 +1,4 @@
1
- require "lib/railtie"
1
+ require "railtie"
2
2
 
3
- module DraftsManager
3
+ module Drafts
4
4
  end
@@ -1,4 +1,4 @@
1
- module DraftsManagerMethods
1
+ module DraftsMethods
2
2
  def self.included base
3
3
  base.class_exec do
4
4
  extend BaseClassMethods
@@ -7,8 +7,8 @@ module DraftsManagerMethods
7
7
 
8
8
  module BaseClassMethods
9
9
  def has_drafts
10
- include DraftsManagerMethods::InstanceMethods
11
- extend DraftsManagerMethods::ClassMethods
10
+ include DraftsMethods::InstanceMethods
11
+ extend DraftsMethods::ClassMethods
12
12
  attr_accessor :draft_id
13
13
  attr_accessible :draft_id
14
14
  after_create :clear_draft
@@ -21,7 +21,7 @@ module DraftsManagerMethods
21
21
  draft = Draft.find_by_id(self.draft_id) || Draft.new
22
22
  attrs = self.attributes.clone.delete_if { |key, value| self.class.accessible_attributes.deny?(key) }
23
23
  cache_attrs = {}
24
- attrs.each { |attr, val| cache_attrs[attr + "_cache"] = self.send(attr + "_cache") if self.send(attr).is_a?(CarrierWave::Uploader::Base) }
24
+ attrs.each { |attr, val| cache_attrs[attr + "_cache"] = self.send(attr + "_cache") if defined?(CarrierWave) && self.send(attr).is_a?(CarrierWave::Uploader::Base) }
25
25
  draft.data = attrs.merge cache_attrs
26
26
  draft.name = self.to_s
27
27
  draft.target_type = self.class.name
@@ -1,11 +1,2 @@
1
- require "lib/drafts_manager"
2
-
3
- module DraftsManager
4
-
5
- class Railtie < Rails::Railtie
6
- initializer "drafts init" do
7
- ActionView::Base.send :include, DraftsManagerMethods
8
- end
9
- end
10
-
11
- end
1
+ require "drafts/draft_methods"
2
+ ActiveRecord::Base.send :include, DraftsMethods
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drafts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -19,7 +19,7 @@ extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - README
22
- - lib/drafts/drafts_manager.rb
22
+ - lib/drafts/draft_methods.rb
23
23
  - lib/drafts.rb
24
24
  - lib/railtie.rb
25
25
  homepage: http://github.com/lxkuz/draft