1. It’s a test that simulates a browser accessing our application.
2. The “erb” stands for “Embedded RuBy”. .erb files look like about.html.erb and live in the “views” directory.They are just html files with embedded ruby in them.
3. Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined
4. The @ indicates that this is an “instance variable”. An instance variable defined in the action (or function) of a controller is automatically available in the view of that same name.
The @ indicates that this is an “instance variable”. An instance variable defined in the action (or function) of a controller is automatically available in the view of that same name.
1. When a request is made for, say, /pages/home, the Pages controller executes the code in the “home” action and then automatically renders the view corresponding to the action — in this case, home.html.erb.
2. This maps requests for the URL /pages/home to the home action in the Pages controller.
3. When the order matters, use an array.
4. It’s a test that simulates a browser accessing our application.
This maps requests for the URL /pages/home to the home action in the Pages controller.
1. Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined
2. Symbols look kind of like strings, but prefixed with a colon instead of surrounded by quotes. For example, :name is a symbol. You can think of symbols as basically strings without all the extra baggage
3. An array uses indices and a hash uses “keys”
4. This is not a standard rails directory, but a directory installed by RSpec in which all test files are kept.
Symbols look kind of like strings, but prefixed with a colon instead of surrounded by quotes. For example, :name is a symbol. You can think of symbols as basically strings without all the extra baggage
1. 300
2. 200
3. 400
4. 150
200
1. When the order matters, use an array.
2. An array uses indices and a hash uses “keys”
3. It’s a test that simulates a browser accessing our application.
4. puts (pronounced “put-ess”)
puts (pronounced “put-ess”)
1. An array uses indices and a hash uses “keys”
2. When a request is made for, say, /pages/home, the Pages controller executes the code in the “home” action and then automatically renders the view corresponding to the action — in this case, home.html.erb.
3. This maps requests for the URL /pages/home to the home action in the Pages controller.
4. When the order matters, use an array.
When a request is made for, say, /pages/home, the Pages controller executes the code in the “home” action and then automatically renders the view corresponding to the action — in this case, home.html.erb.
1. This maps requests for the URL /pages/home to the home action in the Pages controller.
2. The request hits the rails router which dispatches to the proper controller action. In this case, it goes to the index action in the Users controller.
3. Curly braces or do..end. It’s best to use curly braces for short one-line blocks and the do..end for mult-iline blocks.
4. When the order matters, use an array.
Curly braces or do..end. It’s best to use curly braces for short one-line blocks and the do..end for mult-iline blocks.
1. It’s a test that simulates a browser accessing our application.
2. When the order matters, use an array.
3. puts (pronounced “put-ess”)
4. An array uses indices and a hash uses “keys”
It’s a test that simulates a browser accessing our application.
1. This maps requests for the URL /pages/home to the home action in the Pages controller.
2. A controller is a container for a group of (possibly dynamic) web pages
3. When the order matters, use an array.
4. Other than the object “false” itself, nil is the only object that defaults to false.
Other than the object “false” itself, nil is the only object that defaults to false.
1. Ruby complains if we try to evaluate an undefined local variable, but issues no such complaint for an instance variable; instead, instance variables are nil if not defined
2. Symbols look kind of like strings, but prefixed with a colon instead of surrounded by quotes. For example, :name is a symbol. You can think of symbols as basically strings without all the extra baggage
3. This is not a standard rails directory, but a directory installed by RSpec in which all test files are kept.
4. This maps requests for the URL /pages/home to the home action in the Pages controller.
This is not a standard rails directory, but a directory installed by RSpec in which all test files are kept.