Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Ruby Interview Questions and Answers
Home
Questions
Ruby
0
votes
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?
asked
Sep 2, 2022
in
Ruby
by
DavidAnderson
ruby-on-rails
0
votes
Which Rails helper would you use in the application view to protect against CSRF (Cross-Site Request Forgery) attacks?
asked
Sep 2, 2022
in
Ruby
by
DavidAnderson
ruby-on-rails
0
votes
What part of the code below causes the method #decrypt_data to be run?
asked
Sep 2, 2022
in
Ruby
by
DavidAnderson
ruby-on-rails
0
votes
When Ruby methods add an exclamation point at the end of their name (such as sort!), what does it typically indicate?
asked
Sep 2, 2022
in
Ruby
by
DavidAnderson
ruby-on-rails
0
votes
What is a popular alternative template language for generating views in a Rails app that is focused on simple abstracted markup?
asked
Sep 2, 2022
in
Ruby
by
DavidAnderson
rubyonrails
0
votes
If a model class is named Product, in which database table will ActiveRecord store and retrieve model instances?
asked
Sep 2, 2022
in
Ruby
by
DavidAnderson
rubyonrails
0
votes
What is the correct way to generate a ProductsController with an index action using only the command-line tools bundled with Rails?
asked
Sep 2, 2022
in
Ruby
by
DavidAnderson
rubyonrails
+1
vote
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
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
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?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
How would you render a view using a different layout in an ERB HTML view?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
How do you add Ruby code inside Rails views and have its result outputted in the HTML file?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
In ActiveRecord, what is the difference between the has_many and has_many :through associations?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
You are using an existing database that has a table named coffee_orders. What would the ActiveRecord model be named in order to use that table?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
When using an ActiveRecord model, which method will create the model instance in memory and save it to the database?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
What is the reason for using Concerns in Rails?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
In Rails, how would you cache a partial template that is rendered?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
Given this code, which choice would be expected to be a true statement if the user requests the index action?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
Given the URL helper product_path(@product), which statement would be expected to be false?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby
0
votes
For a Rails validator, how would you define an error message for the model attribute address with the message "This address is invalid"?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
How would you generate a drop-down menu that allows the user to select from a collection of product names?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
If a database table of users contains the following rows, and id is the primary key, which statement would return only an object whose last_name is "Cordero"?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
When a validation of a field in a Rails model fails, where are the messages for validation errors stored?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
Are instance variables set within a controller method accessible within a view?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
Given this code, which statement about the database table "documents" could be expected to be true?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
Which ActiveRecord query prevents SQL injection?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
Which choice includes standard REST HTTP verbs?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
+1
vote
In Rails, which code would you use to define a route that handles both the PUT and PATCH REST HTTP verbs?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
Which module can you use to encapsulate a cohesive chunk of functionality into a mixin?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
What is before_action (formerly known as before_filter)?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby-on-rail
0
votes
Which statement correctly describes a difference between the form helper methods form_tag and form_for?
asked
Aug 26, 2022
in
Ruby
by
Robin
ruby
Page:
« prev
1
2
3
4
5
next »
...