- What is the value of
a
after the below code is executed?
a = 1
b = a
b = 3
Answer: `a = 1` after the code is executed.
- What's the difference between an
Array
and aHash
?
Why do they call it a relational database?
We call it a relational database, because the tables within the database are associated with each other. This association can be created with primary/foreign keys and various syntax.
What is SQL?
SQL stands for "Sequence Query Language" and it is used to manage the operations of a relational database.
There are two predominant views into a relational database. What are they, and how are they different?
The two predominant views are the data and schema views. Data view displays like a spreadsheet, with the table columns at the top and rows of data per each object instance.
A schema view shows us the column names and the value type of each column.
resources
keyword in the routes.rb
file. Also name the 4 named routes, and how the request is routed to the controller/action. # Assuming you are getting resources :posts
$ rake routes
get '/posts', to: posts#index => posts_path
get '/posts/object', to: posts#show => post_path(object)
get '/posts/object/edit', to: posts#edit => edit_post_path(object)
What's the difference between rendering and redirecting? What's the impact with regards to instance variables, view templates?
Rendering displays a view template that accesses the instance variables available in that action.
Therefore, instance variables must be declared in that action before the render will work.
Redirecting will send a new request to the browser based on the route path that was provided. In this case, the instance variables in that action are not related to the redirected view.
If I need to display a message on the view template, and I'm redirecting, what's the easiest way to accomplish this?
You can use flash
, which saves the message with a session. The message will be displayed on your next action and will be removed after that.