From 2003381bbbea8e0436d54111d67e8e118601ae80 Mon Sep 17 00:00:00 2001 From: Andrey Molchanov Date: Sat, 17 Sep 2016 14:21:38 +0300 Subject: [ci skip] Fix bad examples in rdoc --- activemodel/lib/active_model/conversion.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb index 8bcad6db0f..12687c70d3 100644 --- a/activemodel/lib/active_model/conversion.rb +++ b/activemodel/lib/active_model/conversion.rb @@ -46,9 +46,13 @@ module ActiveModel # class Person # include ActiveModel::Conversion # attr_accessor :id + # + # def initialize(id) + # @id = id + # end # end # - # person = Person.create(id: 1) + # person = Person.new(1) # person.to_key # => [1] def to_key key = respond_to?(:id) && id @@ -61,12 +65,17 @@ module ActiveModel # class Person # include ActiveModel::Conversion # attr_accessor :id + # + # def initialize(id) + # @id = id + # end + # # def persisted? # true # end # end # - # person = Person.create(id: 1) + # person = Person.new(1) # person.to_param # => "1" def to_param (persisted? && key = to_key) ? key.join("-") : nil -- cgit v1.2.3