Skip to content

Commit

Permalink
Force id to be an Integer
Browse files Browse the repository at this point in the history
  • Loading branch information
tpope committed Mar 4, 2009
1 parent b5cec8a commit 338f104
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/pickler/tracker.rb
Expand Up @@ -97,7 +97,10 @@ def self.accessor(*methods)
define_method("#{method}=") { |v| @attributes[method.to_s] = v }
end
end
reader :id

def id
id = @attributes['id'] and Integer(id)
end

def to_xml(options = nil)
@attributes.to_xml({:dasherize => false, :root => self.class.name.split('::').last.downcase}.merge(options||{}))
Expand Down

0 comments on commit 338f104

Please sign in to comment.