Limited Period Offer - Upto 50% OFF | OFFER ENDING IN: 0 D 0 H 0 M 0 S

Log In to start Learning

Login via

Post By Admin Last Updated At 2020-06-15
Ruby on Rails Interview Questions

You are right place, If you are looking for Ruby on Rails Interview Questions and answers, get more confidence to crack interview by reading this questions and answers we will update more and more latest questions for you…

  1. Explain what is Ruby on Rails?

Ruby:  Ruby is an object-oriented programming language To Develop the Front End Applications inspired by PERL and PYTHON.

Rails: Rail is a framework used for building a web application. It is Open source Programming Language.

  1. Explain the features of ruby on rails?

The Main features of ruby on rails are listed below-

Meta-programming: code Feature is used but for heavy lifting, it uses meta-programming.

Active record: objects are saved to the database Include this framework. It determines the columns in a schema and binds them to your domain object.

Scaffolding: it means it has the ability to create temporary code automatically.

Convention over configuration: much configuration is not desired if the naming convention is followed.

Three environments: testing, development, and production are the 3 default environments in this framework.

Built-in testing: test cases are used in this for writing and executing the codes.

  1. What is Rails Active Record in Ruby on Rails?

Rails active record is the Object/Relational Mapping (ORM) layer supplied with Rails. It follows the standard ORM model as

  • Table map to classes
  • Rows map to objects
  • Columns map to object attributes
  1. Explain what is the role of sub-directory app/controllers and app/helpers?

App/controllers: A web request from the user is Manage by the Controller. The controller sub-directory is where Rails looks to find controller classes

App/helpers: The helper’s sub-directory holds any helper classes used to assist the view, model and controller classes.

  1. What is Rails Migration?

Rails Migration enables Ruby to make an advance to the database schema, making it possible to use a version control system to leave things synchronized with the actual code.

  1. List out what can Rails Migration do?

Rails Migration can do the following things

  • Create a table
  • Drop table
  • Rename table
  • Add column
  • Rename column
  • Change column
  • Remove column and so on
  1. Explain when self. Up and self. Down method is used?

When migrating to a new version, self. Up method is used while self. Down method is used to roll back my changes if needed.

  1. In Ruby, it explains about the defined operator?

The defined operator tells whether a passed expression is defined or not.  If the expression is not defined, it gives null, and if the expression is defined it returns the description string.

  1. Explain what is Mix in in Rails?

Mix in in Ruby offers an alternative to multiple inheritances, using mix in modules can be imported inside other class.

  1. Explain how you define Instance Variable, Global Variable and Class Variable in Ruby?
  • Ruby Instance variable begins with — @
  • Ruby Class variables begin with — @@
  • Ruby Global variables begin with — $
Enroll Now for the demo session at Ruby on rails course
  1. What is Polymorphic Association in Ruby on Rails?

Polymorphic Association allows an Active Record object to be connected with various Active Record objects. A perfect example of Polymorphic Association is a social site where users can comment on anywhere whether it is videos, photos, link, status updates etc. It would be not feasible if you have to create an individual comment like photos comments, videos comment and so on.

  1. What is a class library in Ruby?

Ruby class libraries subsist of a variety of domains, such as thread programming, data types, various domains, etc. These classes give flexible capabilities at a high level of abstraction, giving you the ability to create powerful Ruby scripts useful in a variety problem domain. The following domains which have related class libraries are,

  • GUI programming
  • Network programming
  • CGI Programming
  • Text processing
  1. Mention the log that has to be seen to report errors in Ruby Rails?

Rails will report errors from Apache in the log/Apache.log and errors from the Ruby code in log/development.log.

  1. What is the command to create a migration?

To create migration command includes

C:\ruby\application>ruby script/generate migration table name
  1.  How Rails implements Ajax?

 Ajax-powered web page retrieves the web page from the server which is new or changed unlike another web-page where you have to refresh the page to get the latest information.

Keep Learning: