This file contains hidden or 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
| User.find(params[:id]) rescue nil #=> Don't even get me started. |
This file contains hidden or 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
| begin | |
| a = Account.find(8675309) #=> Sadly, Jenny's not a user. | |
| rescue | |
| # I'm so cool I don't need to do anything here. | |
| end | |
| # If I ever find that Tommy... | |
| a.update_attribute(:location, "bathroom wall") |
This file contains hidden or 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
| begin | |
| user = User.find(:frist) #=> Bill Frist? | |
| user.update_attribute(:alive_or_dead) #=> Care to be more specific? | |
| rescue => e | |
| logger.error "Something bad happened" #=> Yeah, but what? | |
| end |
This file contains hidden or 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
| foo(nil) #=> nil | |
| foo #=> Tue Jan 13 03:22:44 -0800 2009 |
This file contains hidden or 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
| def foo(a=Time.now.utc) | |
| puts a | |
| end |
This file contains hidden or 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
| [3] <enki> [10:51 PM] ~>irb | |
| >> x.blank? | |
| NameError: undefined local variable or method `x' for main:Object | |
| from (irb):1 | |
| >> | |
This file contains hidden or 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
| class ApplicationController | |
| protected | |
| def iphone? | |
| request.class.to_s.include?("CgiRequest") && request.user_agent.include?('iPhone') | |
| end | |
| end | |
| class ApplicationHelper | |
| def iphone? |
NewerOlder