Ruby Onrails

Ruby Onrails

May 29, 2017 Uncategorized 0

1) Explain what is Ruby on Rails?
Ruby: It is an object oriented programming language inspired by PERL and PYTHON.
Rails: It is a framework used for building web application

2)what are the class libraries in Ruby?
Class libraries in Ruby consist of a variety of domains, such as data types, thread programming, various domains, etc.

3)what is the naming convention in Rails?
>Class and Module
>Database Table

4) Explain what is “Yield” in Ruby on Rails?
A Ruby metho
d that receives a code block invokes it by calling it with the “Yield”.

5) Explain what is ORM (Object-Relationship-Model) in Rails?
ORM or Object Relationship Model in Rails indicate that your classes are mapped to the table in the database, and objects are directly mapped to the rows in the table.

6) Mention what the difference is between false and nil in Ruby?
In Ruby False indicates a Boolean datatype, while Nil is not a data type.

7) Mention what are the positive aspects of Rails?
Meta-programming: Rails uses code generation but for heavy lifting it relies on meta-programming.
Active Record:It saves object to the database through Active Record Framework.
Scaffolding:Rails have an ability to create scaffolding or temporary code automatically
Convention over configuration:Unlike other development framework, Rails does not require much configuration.

8) Explain what is the role of sub-directory app/controllers and app/helpers?
App/controllers: A web request from the user is handled by the Controller.
App/helpers: The helper’s sub-directory holds any helper classes used to assist the view, model and controller classes.

9) Mention what is the difference between String and Symbol?
The difference lies in the object_id, memory and process tune when they are used together. Symbol belongs to the category of immutable objects whereas Strings are considered as mutable objects.

10) Explain how Symbol is different from variables?
>It is more like a string than variable
>In Ruby string is mutable but a Symbol is immutable
>Only one copy of the symbol requires to be created
>Symbols are often used as the corresponding to enums in Ruby