forked from appoxy/simple_record
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed up some error handling for RecordNotSaved.
- Loading branch information
Travis Reeder
committed
Jan 5, 2011
1 parent
7bf1552
commit f21d4d9
Showing
4 changed files
with
19 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,9 @@ | ||
require_relative 'my_model' | ||
|
||
class ToSClass | ||
def to_s | ||
"#{self.class.name} to_s called" | ||
end | ||
end | ||
class InspectClass | ||
def inspect | ||
"#{self.class.name} inspect called" | ||
end | ||
end | ||
class BothClass | ||
def inspect | ||
"#{self.class.name} inspect called" | ||
end | ||
def to_s | ||
"#{self.class.name} to_s called" | ||
end | ||
end | ||
|
||
c1 = ToSClass.new | ||
puts c1.inspect | ||
puts c1.to_s | ||
c1 = InspectClass.new | ||
puts c1.inspect | ||
puts c1.to_s | ||
c1 = BothClass.new | ||
puts c1.inspect | ||
puts c1.to_s | ||
|
||
a = [] | ||
afirst = a.first | ||
puts 'afirst=' + afirst.inspect | ||
|
||
p = nil | ||
puts 'p=' + p.inspect.to_s | ||
puts "p=" + p.inspect | ||
|
||
p = MyModel.new | ||
puts 'p=' + p.inspect.to_s | ||
puts 'p=' + p.to_s | ||
puts "p=" + p.inspect | ||
|
||
id = 123 | ||
puts 'id&&id ' + (id && id.to_s).inspect | ||
begin | ||
raise StandardError | ||
rescue => ex | ||
p ex | ||
puts ex.message | ||
end |