Ruby On Rails Interview Questions And Answers
RVM stands for Ruby Version Manager. It is a command line tool which allows you to easily install, manage and work with different Ruby environments. With RVM, you can easily install different versions of Ruby and easily switch between them.
Define Rails Migrations?
Migrations are a way to alter database schema over time in a consistent and organized manner. They use a Ruby DSL through which there is no need to write SQL by hand.
Define Rails Router?
The Rails router recognizes URLs and dispatches them to a controller's action. It also generate paths and URLs. Rails router deals URLs in a different way from other language routers. It determines controller, parameters and action for the request.
Define Rails Scaffolding?
Scaffolding is a quick way to produce some major pieces of an application. For auto generating a set of models, views and controllers for a new resource in a single operation, scaffolding is used.
What are rails filters?
Rails filters are methods that run before or after a controller's action method is executed. They are helpful when you want to ensure that a given block of code runs with whatever action method is called.
Rails support three types of filter methods:
- Before filters
- After filters
- Around filters
What is Testing in Rails?
Rails test is very simple to write and run for your application. As Rails script generates models and controllers, in the same way test files are also generated. Rails also uses a separate database for testing. Test database in an application is rebuilt each time the application's test run, and hence you always have a consistent database when your tests are run.
Ruby Supports Single Inheritance/multiple Inheritance Or Both?
Ruby Supports only Single Inheritance
What Are The Components Defined In The Model From Mvc Architecture?
The components involved in defining the model are as follows:
Validations: this is one of the very essential components and it defines the validations that are being put up on the input type of stream like validate_presence_of, format_of, etc.
Relationship: this is another type of component that describe the relationship between different types of components and it shows the relationship in the form of has_one, has_many, etc.
Callbacks: this is essential when it comes to respond after the failure and it allows the application to have certain functionality during failure. This can be given as before_save, after_save, etc.
Validation group settings: allow users to define the installed plugin settings.
Active record association relationship: allows current records to be actively having the relationship between one another.
What Is Active Record?
Active Record are like Object Relational Mapping(ORM), where classes are mapped to table and objects are mapped to columns in the table.
Interested in mastering Ruby on Rails Training? Enroll now for FREE demo on
What is Rails Caching?
Caching is used in any web technologies. It speeds up the performance by storing previous results for subsequent requests. By default, cahcing is disabled in Rails.
Rails caching is available at three levels of granularity:
What is CoC in Rails?
DRY stands for Convention over Configuration. It provides different opinions for the best way to do many things in a web application.
Who developed Rails?
Ruby on Rails was created by David Heinemeier Hansson (DHH).
What is the use of super function in Ruby on Rails?
The super function in Ruby is used to invoke the original method. It calls the super class implementation of the current method.
How Many Types Of Callbacks Available In Ror?
What Are The Servers Supported By Ruby On Rails?
RoR was generally preferred over WEBrick server at the time of writing, but it can also be run by:
Lighttpd (pronounced ‘lighty’) is an open-source web server more optimized for speed-critical environments.
Abyss Web Server- is a compact web server available for windows, Mac osX and Linux operating system. Apache and nginx
What Is The Log That Has To Seen To Check For An Error In Ruby Rails?
Rails will report errors from Apache in log/apache.log and errors from the ruby code in log/development.log. If you having a problem, do have a look at what these log are saying.