Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

remove InstanceMethods module to fix depreciation notice with latest ActiveSupport #15

Merged
merged 1 commit into from

2 participants

@yyyc514

Can we please get a new release? If I need to update the version and such I could do that as well... just let me know.

@jnunemaker jnunemaker merged commit 54cde68 into jnunemaker:master
@jnunemaker
Owner

0.6.2 is out.

@yyyc514

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 2, 2012
  1. @yyyc514
This page is out of date. Refresh to see the latest.
Showing with 40 additions and 42 deletions.
  1. +40 −42 lib/joint/instance_methods.rb
View
82 lib/joint/instance_methods.rb
@@ -1,52 +1,50 @@
module Joint
- module InstanceMethods
- def grid
- @grid ||= Mongo::Grid.new(database)
- end
+ def grid
+ @grid ||= Mongo::Grid.new(database)
+ end
- private
- def assigned_attachments
- @assigned_attachments ||= {}
- end
+ private
+ def assigned_attachments
+ @assigned_attachments ||= {}
+ end
- def nil_attachments
- @nil_attachments ||= {}
- end
+ def nil_attachments
+ @nil_attachments ||= {}
+ end
- # IO must respond to read and rewind
- def save_attachments
- assigned_attachments.each_pair do |name, io|
- next unless io.respond_to?(:read)
- io.rewind if io.respond_to?(:rewind)
- grid.delete(send(name).id)
- grid.put(io, {
- :_id => send(name).id,
- :filename => send(name).name,
- :content_type => send(name).type,
- })
- end
- assigned_attachments.clear
+ # IO must respond to read and rewind
+ def save_attachments
+ assigned_attachments.each_pair do |name, io|
+ next unless io.respond_to?(:read)
+ io.rewind if io.respond_to?(:rewind)
+ grid.delete(send(name).id)
+ grid.put(io, {
+ :_id => send(name).id,
+ :filename => send(name).name,
+ :content_type => send(name).type,
+ })
end
-
- def nullify_nil_attachments_attributes
- nil_attachments.each_key do |name|
- send(:"#{name}_id=", nil)
- send(:"#{name}_size=", nil)
- send(:"#{name}_type=", nil)
- send(:"#{name}_name=", nil)
- end
+ assigned_attachments.clear
+ end
+
+ def nullify_nil_attachments_attributes
+ nil_attachments.each_key do |name|
+ send(:"#{name}_id=", nil)
+ send(:"#{name}_size=", nil)
+ send(:"#{name}_type=", nil)
+ send(:"#{name}_name=", nil)
end
+ end
- def destroy_nil_attachments
- nil_attachments.each_value do |id|
- grid.delete(id)
- end
-
- nil_attachments.clear
+ def destroy_nil_attachments
+ nil_attachments.each_value do |id|
+ grid.delete(id)
end
- def destroy_all_attachments
- self.class.attachment_names.map { |name| grid.delete(send(name).id) }
- end
- end
+ nil_attachments.clear
+ end
+
+ def destroy_all_attachments
+ self.class.attachment_names.map { |name| grid.delete(send(name).id) }
+ end
end
Something went wrong with that request. Please try again.