Ror Software Engineer
Ror Software Engineer Interview Questions and Answers
Q1. what are different types of associations?
Different types of associations include one-to-one, one-to-many, many-to-many, and polymorphic associations.
One-to-one association: each record in one table is associated with one and only one record in another table.
One-to-many association: each record in one table is associated with one or more records in another table.
Many-to-many association: each record in one table is associated with one or more records in another table, and vice versa.
Polymorphic association: a single ...read more
Q2. how to handle exceptions in ruby?
Exceptions in Ruby can be handled using the 'begin', 'rescue', and 'ensure' keywords.
Use 'begin' to start a block of code that may raise an exception
Use 'rescue' to catch the exception and handle it
Use 'ensure' to ensure that a block of code is always executed, regardless of whether an exception was raised or not
Use 'raise' to manually raise an exception
Use 'retry' to retry a block of code if an exception was raised
Q3. explain model view controller model in ROR
MVC is a design pattern that separates an application into three interconnected components: Model, View, and Controller.
Model represents the data and business logic of the application
View is responsible for rendering the user interface
Controller handles user input and updates the model and view accordingly
In ROR, the model is typically represented by a database table, the view is an HTML template, and the controller is a Ruby class
MVC helps to keep code organized, maintainabl...read more
Q4. use type field in table for polymorphic
Using a type field in a table allows for polymorphic associations between different models.
The type field stores the name of the associated model.
This allows for easy querying and retrieval of associated records.
Example: a comments table can have polymorphic associations with both posts and articles.
The type field would store either 'Post' or 'Article' depending on the associated record.
Ror Software Engineer Jobs
0Interview Questions of Similar Designations
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month