attachable 0.0.1 → 0.0.2

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/Rakefile CHANGED
@@ -1 +1,11 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ desc 'Default: run unit tests.'
5
+ task :default => :test
6
+
7
+ desc 'Test the attachable plugin.'
8
+ Rake::TestTask.new(:test) do |t|
9
+ t.libs << 'test'
10
+ t.pattern = 'test/**/*_test.rb'
11
+ end
@@ -15,17 +15,13 @@ module Attachable
15
15
  cattr_accessor :attachment_file_prefix
16
16
  self.attachment_file_prefix = (options[:file_prefix] || :file).to_s
17
17
 
18
- # Setup the default scope so the file data isn't included by default
19
- send :default_scope, attachable_scope
18
+ # Setup the default scope so the file data isn't included by default.
19
+ # Generate the default scope, which includes every column except for the data column.
20
+ # We use this so queries, by default, don't include the file data which could be quite large.
21
+ default_scope { select(column_names.reject { |n| n == "#{attachment_file_prefix}_data" }.collect {|n| "#{table_name}.#{n}" }.join(',')) }
20
22
 
21
23
  # Include all the important stuff
22
- send :include, InstanceMethods
23
- end
24
-
25
- # Generate the default scope, which includes every column except for the data column.
26
- # We use this so queries, by default, don't include the file data which could be quite large.
27
- def attachable_scope
28
- select(column_names.reject { |n| n == "#{attachment_file_prefix}_data" }.collect {|n| "#{table_name}.#{n}" }.join(','))
24
+ include InstanceMethods
29
25
  end
30
26
  end
31
27
 
@@ -1,3 +1,3 @@
1
1
  module Attachable
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attachable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: