w4d1 Flashcards
What’s a good key for errors in a validation?
the name of the column
better yet:
:column_name_id
What does instance_variable_get do?
and instance_variable_set
Gets/sets an instance variable without using a getter
What does send do?
It takes in a symbol/string that corresponds to an instance variable and invokes that method
How do you call define method from outside of the containing class?
SomeClass.send(:define_method, :method_name, &prc)
Where prc is the block you’d normally pass to define_method
What do you always have to do if you overwrite method_missing?
call super if our conditions aren’t satisfied
What 6 methods are key to metaprogramming?
#send #define_method #method_missing #instance_variable_get #instance_variable_set #methods
How do you see routes?
rails routes
What are the RESTful methods?
index create update show destroy