Skip to content

Instantly share code, notes, and snippets.

@ymek
Created October 27, 2015 16:57
Show Gist options
  • Save ymek/89e3beb4f6aecc9aa455 to your computer and use it in GitHub Desktop.
Save ymek/89e3beb4f6aecc9aa455 to your computer and use it in GitHub Desktop.
#
# Many novices, looking to get started with web programming, fall into the trap
# of learning Rails before achieving a solid grasp of the Ruby language. To
# understand Rails, one should have a basic understanding of programming
# fundamentals, especially Objects and Inheritance.
#
# Additionally, there are many Rails-specific methods patched into the Object
# class. While this is incredibly convenient, it makes learning Ruby as
# a language somewhat obtuse. For an example, consider the following snippet:
foo = []
foo.present?
# In Rails, this would evaluate to true. In vanilla Ruby, a NoMethodError
# exception is raised. The equivalent vanilla Ruby version:
foo = []
!foo.empty?
# While this contrived example seems simple enough, the underlying mechanics
# and implications are very important concepts to understand when using Rails
# in general, as this approach is oft-used within.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment