Ruby for Rails: Ruby Techniques for Rails Developers

Category: Programming
Author: David Black
This Month Stack Overflow 2


by anonymous   2019-07-21

You can. RoR is in a way a domain specific language, since a lot is defined for you and putting a simple application together can be like following a straightforward recipe. It would of course be better to learn the language properly, but many people don't.

The Ruby For Rails book tries to teach you both at the same time, so you might want to look into getting that one. I haven't read it but I hear it's pretty good.

by anonymous   2019-01-13

Public - can be called from anywhere

Private - The method cannot be called outside class scope. The object can only send the message to itself

ex: the baker has bake method as public but break_eggs is private

Protected - You can call an object's protected methods as long as the default object self is an instance of the same class as the object whose method you're calling

ex: with n protected method, c1 can ask c2 to execute c2.n, because c1 and c2 are both instances of the same class

And last but not least:

  • Inheritance: Subclasses inherit the method-access rules of their superclass

if "class D < C", then D will exhibit the same access behaviour as instances of C