Displaying 2 results from an estimated 2 matches for "copyable_attribut".
Did you mean:
copyable_attributes
2006 Jun 21
1
Plugin Panic! - no accessing a model''s class methods?
Hi plugin-authors.
So this is a little bit of take two on this question, but why can''t I
access a singleton on the model calling my plugin? The crux of the full
plugin below is:
#logger.info self.class.to_s
new_copy = self.class.new( @copyable_attributes )
the logger spits out "Datatype", but I get an error from rails saying:
undefined method `datatype'' for false:FalseClass
for the self.class.new line. I also feel haunted by the knowledge that
this is far easier than I think it is, though I cannot seem to find the
answer...
2006 Jun 05
0
Plugin Namespace Oddities?
...bility to:
@new_ar_object = @ar_object.copy
I''m using the Fox example for the basic loading into AR with a module:
http://wiki.rubyonrails.org/rails/pages/HowToWriteAnActsAsFoxPlugin
so in my instance methods:
module InstanceMethods
def copy( options = {} )
copyable_attributes = self.attributes
copyable_attributes.delete ''id''
options.each do |key, value|
next if key.class == String
options.delete key
options[key.to_s] = value
end
copyable_attributes.merge! options
lo...