Ruby on Rails Part-II
Sign in to Google to save your progress. Learn more
You made a spelling mistake while creating a table for bank accounts. Which code would you expect to see in a migration to fix the error? *
1 point
Given this controller code, which choice describes the expected behavior if parameters are submitted to the update action that includes values for the product's name, style, color, and price? *
1 point
Captionless Image
In the model User you have the code shown below. When saving the model and model.is_admin is set to true, which callback will be called? *
1 point
Captionless Image
Review the code below. Which Ruby operator should be used to fill in the blank so that the sort method executes properly? *
1 point
Captionless Image
Which Rails helper would you use in the application view to protect against CSRF (Cross-Site Request Forgery) attacks? *
1 point
How do you add Ruby code inside Rails views and have its result outputted in the HTML file? *
1 point
Where should you put images, JavaScript, and CSS so that they get processed by the asset pipeline? *
1 point
If a model class is named Product, in which database table will ActiveRecord store and retrieve model instances? *
1 point
A Rails project has ActiveRecord classes defined for Classroom and Student. If instances of these classes are related so that students are assigned the ID of one particular classroom, which choice shows the correct associations to define? *
1 point
If the Rails asset pipeline is being used to serve JavaScript files, how would you include a link to one of those JavaScript files in a view? *
1 point
Which ActiveRecord query prevents SQL injection? *
1 point
What is a popular alternative template language for generating views in a Rails app that is focused on simple abstracted markup? *
1 point
In Rails, what caching stores can be used? *
1 point
In ActiveRecord, what is the difference between the has_many and has_many :through associations? *
1 point
Which HTML is closes to what this code would output? *
1 point
Captionless Image
What part of the code below causes the method #decrypt_data to be run? *
1 point
Captionless Image
When Ruby methods add an exclamation point at the end of their name (such as sort!), what does it typically indicate? *
1 point
What is the correct way to generate a ProductsController with an index action using only the command-line tools bundled with Rails? *
1 point
How would you render a view using a different layout in an ERB HTML view? *
1 point
In a Rails controller, what does the code params.permit(:name, :sku) do? *
1 point
Submit
Clear form
This content is neither created nor endorsed by Google.