Top 100+ Ruby On Rails Interview Questions And Answers
Question 1. What Is Rails?
Answer :
Rails is a extremely efficient internet-application framework written in Ruby language by way of David Hansson.
Rails are an open supply Ruby framework for developing database-backend internet programs.
Rails encompass the whole thing had to create a database-driven web application the usage of the Model-View-Controller (MVC) sample.
Question 2. What Are The Various Components Of Rail?
Answer :
Action Pack: Action Pack is a unmarried gem that consists of Action Controller, Action View and Action Dispatch. The “VC” a part of “MVC”.
Action Controller: Action Controller is the issue that manages the controllers in a Rails utility. The Action Controller framework tactics incoming requests to a Rails software, extracts parameters, and dispatches them to the intended movement.
Services provided by way of Action Controller encompass consultation management, template rendering, and redirect management.
Action View: Action View manages the views of your Rails application. It can create each HTML and XML output through default.
Action View manages rendering templates, together with nested and partial templates, and includes built-in AJAX guide.
Action Dispatch: Action Dispatch handles routing of internet requests and dispatches them as you need, both in your software or any other Rack utility. Rack applications are a more advanced subject matter and are blanketed in a separate guide called Rails on Rack.
Action Mailer: Action Mailer is a framework for building e mail offerings. You can use Action Mailer to get hold of and procedure incoming electronic mail and send easy simple text or complicated multipart emails based totally on bendy templates.
Active Model: Active Model provides a described interface among the Action Pack gem offerings and Object Relationship Mapping gemstones including Active Record. Active Model allows Rails to utilize other ORM frameworks in area of Active Record in case your application wishes this.
Active Record: Active Record are like Object Relational Mapping (ORM), in which training are mapped to desk, gadgets are mapped to columns and item attributes are mapped to information in the table.
Active Resource: Active Resource presents a framework for managing the relationship among enterprise gadgets and RESTful web services. It implements a way to map internet-based totally assets to neighborhood items with CRUD semantics.
Active Support: Active Support is an extensive collection of software classes and popular Ruby library extensions that are utilized in Rails, both with the aid of the middle code and by using your applications.
Python Interview Questions
Question 3. Explain About Restful Architecture?
Answer :
RESTful: REST stands for Representational State Transfer. REST is an architecture for designing both internet applications and alertness programming interfaces (API’s), that’s makes use of HTTP.
RESTful interface way easy URLs, much less code, CRUD interface. CRUD way Create-READ-UPDATE-DESTROY. In REST, they upload 2 new verbs, i.E, PUT, DELETE.
Question 4. Why Ruby On Rails?
Answer :
There are lot of benefits of using ruby on rails.
DRY Principal( Don’t Repeat Yourself): It is a principle of software program development aimed at decreasing repetition of code. “Every piece of code have to have a unmarried, unambiguous representation within a device”
Convention over Configuration: Most internet development framework for .NET or Java pressure you to jot down pages of configuration code. If you follow advised naming conventions, Rails doesn’t want an awful lot configuration.
Gems and Plugins: RubyGems is a package manager for the Ruby programming language that provides a popular layout for dispensing ruby applications and library.
Plugins: A Rails plugin is both an extension or a change of the middle framework. It gives a manner for builders to share bleeding-part thoughts without hurting the stable code base. We need to determine if our plugin may be potentially shared throughout special Rails applications.
Scaffolding: Scaffolding is a meta-programming approach of constructing database-backend software application. It is a way supported by MVC frameworks, wherein programmer may additionally write a specification, that describes how the application database can be used. There are two form of scaffolding:
-static: Static scaffolding takes 2 parameter i.E your controller name and model name.
-dynamic: In dynamic scaffolding you need to outline controller and model one after the other.
Rack Support: Rake is a software program undertaking control tool. It allows you to specify duties and describe dependencies in addition to to group obligations in a namespace.
Metaprogramming: Metaprogramming strategies use applications to put in writing packages.
Bundler: Bundler is a brand new concept added in Rails 3, which helps you to manipulate your gems for application. After specifying gem file, you want to do a package install.
Rest Support.
Action Mailer
Python Tutorial
Question five. What Do You Mean By Render And Redirect_to?
Answer :
render reasons rails to generate a reaction whose content is furnished via rendering one in all your templates. Means, it will direct goes to view page.
Redirect_to generates a response that, instead of delivering content to the browser, simply tells it to request some other url. Means it first assessments actions in controller and then goes to view page.
HTML five Interview Questions
Question 6. What Is Orm In Rails?
Answer :
ORM tends for Object-Relationship-Model, wherein Classes are mapped to table in the database, and Objects are without delay mapped to the rows in the table.
Question 7. How Many Types Of Associations Relationships Does A Model Have?
Answer :
When you have got multiple model to your rails application, you would need to create connection among the ones fashions. You can do this thru institutions. Active Record helps 3 styles of institutions:
one-to-one: A one-to-one dating exists whilst one object has precisely one among some other item. For instance, a person has exactly one birthday or a dog has exactly one proprietor.
One-to-many: A one-to-many courting exists when a unmarried item can be a member of many different objects. For example, one concern can have many books.
Many-to-many: A many-to-many courting exists while the first item is related to one or more of a 2nd item, and the second item is associated with one or some of the first object.
You indicate those institutions by way of including declarations for your models: has_one, has_many, belongs_to, and has_and_belongs_to_many.
HTML five Tutorial PHP Interview Questions
Question 8. What Are Helpers And How To Use Helpers In Ror?
Answer :
Helpers are modules that offer methods which might be mechanically usable for your view. They offer shortcuts to usually used display code and a way as a way to maintain the programming out of your views. The reason of a helper is to simplify the view.
Question 9. What Are Filters?
Answer :
Filters are techniques that run “before”, “after” or “around” a controller movement. Filters are inherited, so if you set a clear out on ApplicationController, it'll be run on each controller on your application.
PostgreSQL Interview Questions
Question 10. What Is Mvc? And How It Works?
Answer :
MVC tends for Model-View-Controller, utilized by many languages like PHP, Perl, Python and many others. The glide goes like this:
Request first comes to the controller, controller reveals and suitable view and interacts with version, model interacts together with your database and ship the response to controller then controller based totally on the reaction deliver the output parameter to view.
PHP Tutorial
Question 11. What Is Session And Cookies?
Answer :
Session is used to store consumer facts on the server aspect. Maximum size is four kb. Cookies are used to store records on the browser side or we are able to say client side.
Ruby Interview Questions
Question 12. What Is Request.Xhr?
Answer :
A request.Xhr tells the controller that the new Ajax request has come, It usually return Boolean values (TRUE or FALSE)
Python Interview Questions
Question 13. What Things We Can Define In The Model?
Answer :
There are lot of factors you may outline in fashions few are:
Validations (like validates_presence_of, numeracility_of, format_of and so on.)
Relationships (like has_one, has_many, HABTM etc.)
Callbacks (like before_save, after_save, before_create and so on.)
Suppose you mounted a plugin say validation_group, So you may also outline validation_group settings in your version
ROR Queries in Sql
Active report Associations Relationship
Django Tutorial
Question 14. How Many Types Of Callbacks Available In Ror?
Answer :
before_validation
before_validation_on_create
validate_on_create
after_validation
after_validation_on_create
before_save
before_create
after_create
after_save
Question 15. How To Serialize Data With Yaml?
Answer :
YAML is a clear-cut device parsable information serialization layout, designed for human clarity and interaction with scripting language consisting of Perl and Python.
YAML is optimized for records serialization, formatted dumping, configuration documents, log documents, internet messaging and filtering.
Django Interview Questions
Question 16. How To Use Two Databases Into A Single Application?
Answer :
magic multi-connections permits you to put in writing your model as soon as, and use them for the more than one rails databases on the identical time.
Sudo gem deploy magic_multi_connection. After putting in this gem, simply add this line at bottom of your surroundings.Rb require “magic_multi_connection”
Git (software) Tutorial
Question 17. What Are The Various Changes Between The Rails Version 2 And 3?
Answer :
Introduction of bundler (new manner to manipulate your gem dependencies)
Gemfile and Gemfile.Lock (in which all of your gem dependencies lies, instead of environment.Rb)
HTML5 assist
Git (software) Interview Questions
Question 18. What Is Tdd And Bdd?
Answer :
TDD stands for Test-Driven-Development and BDD stands for Behavior-Driven-Development.
HTML five Interview Questions
Question 19. What Are The Servers Supported By Ruby On Rails?
Answer :
RoR turned into normally desired over WEBrick server on the time of writing, however it is able to additionally be run via:
Lighttpd (pronounced ‘lighty’) is an open-supply web server more optimized for pace-important environments.
Abyss Web Server- is a compact web server available for windows, Mac osX and Linux operating machine. Apache and nginx
Javascript Advanced Tutorial
Question 20. What Do You Mean By Naming Convention In Rails.
Answer :
Variables: Variables are named in which all letters are lowercase and phrases are separated via underscores. E.G: total, order_amount.
Class and Module: Classes and modules uses MixedCase and have no underscores, each phrase begins with a uppercase letter. Eg: InvoiceItem
Database Table: Table call have all lowercase letters and underscores between words, additionally all desk names to be plural. Eg: invoice_items, orders etc
Model: The model is named the use of the elegance naming convention of unbroken MixedCase and continually the singular of the desk name.
For eg: desk call is is probably orders, the version call would be Order. Rails will then search for the class definition in a file called order.Rb in /app/version directory. If the version class call has more than one capitalized words, the table name is assumed to have underscores among those phrases.
Controller: controller elegance names are pluralized, such that Orders Controller would be the controller magnificence for the orders table. Rails will then search for the elegance definition in a report referred to as orders_controlles.Rb within the /app/controller listing.
Javascript Advanced Interview Questions
Question 21. What Is The Log That Has To Seen To Check For An Error In Ruby Rails?
Answer :
Rails will file errors from Apache in log/apache.Log and errors from the ruby code in log/development.Log. If you having a trouble, do have a look at what those log are saying.
Question 22. How You Run Your Rails Application Without Creating Databases?
Answer :
You can run your utility by uncommenting the line in environment.Rb
route=> rootpath conf/environment.Rb
config.Frameworks-=[action_web_service,:action_mailer,:active_record
Ruby on Rails 2.1 Tutorial
Question 23. How To Use Sql Db Or Mysql Db Without Defining It In The Database.Yml?
Answer :
You can use ActiveRecord everywhere
require “rubygems”
require “active_record”
ActiveRecord::Base.Establish_connection( :adapter=> ‘postgresql’, :user=>’foo’, :password=> ‘abc’, :database => ’some thing’)
wxPython Interview Questions
Question 24. Get And Post Method?
Answer :
GET is essentially for just getting (retrieving) information, whereas POST may additionally involve whatever, like storing or updating statistics, or ordering a product, or sending E-mail.
PHP Interview Questions
Question 25. What Is The Difference Between Static And Dynamic Scaffolding?
Answer :
The Syntax of Static Scaffold is like this:
ruby script/generate scaffold User Comment Where Comment is the model and User is your controller, So all n all static scaffold takes 2 parameter i.E your controller name and version call, whereas in dynamic scaffolding you need to define controller and version one at a time.
WxPython Tutorial
Question 26. How Many Types Of Relationships Does A Model Has?
Answer :
has_one
belongs_to
has_many
has_many :thru
MongoDB Interview Questions
Question 27. Difference Between Render And Redirect?
Answer :
render instance: render :movement, render :partial and so on. Redirect example: redirect_to :controller => ‘users’, :motion => ‘new’
PostgreSQL Interview Questions
Question 28. What Is Active Record?
Answer :
Active Record are like Object Relational Mapping(ORM), wherein instructions are mapped to table and gadgets are mapped to columns in the desk.
MongoDB Tutorial
Question 29. Ruby Supports Single Inheritance/a couple of Inheritance Or Both?
Answer :
Ruby Supports only Single Inheritance
Python Automation Testing Interview Questions
Question 30. What Is Bundler?
Answer :
Bundler is a new concept introduced in Rails3, which helps to you manage your gems for the application. After specifying gemstones in your Gemfile, you want to do a package install. If the gem is available inside the gadget, package will use that else it'll pick up.
Question 31. What Is The Newest Approach For Find(:all) In Rails 3?
Answer :
Model.Where(:activated => actual)
Question 32. What Is The Role Of Mvc Architecture In Ruby On Rails?
Answer :
MVC (Model-View-Controller) is the structure that gives flexibility and scalability of the applications.
It is sort of having the same concept in every other language like PHP, Perl or Python. It is one of the fundamental used architecture involved today due to its simplicity.
Controller is the primary part in this kind of structure wherein it handles the request that is coming from any other controller.
Controller contacts the view and passes on the request to the view and it also interacts with the model to outline the sort of request.
Model is chargeable for interacting with the database and presents the responses to the controller.
Controller takes the reaction and gives the reaction inside the output form to the user that has made the request.
GitHub Interview Questions
Question 33. What Are The Components Defined In The Model From Mvc Architecture?
Answer :
The additives concerned in defining the version are as follows:
Validations: this is one of the very important additives and it defines the validations which can be being placed up at the input form of flow like validate_presence_of, format_of, etc.
Relationship: that is another sort of thing that describe the relationship between one of a kind forms of components and it suggests the relationship inside the form of has_one, has_many, and many others.
Callbacks: that is important when it comes to reply after the failure and it lets in the software to have sure functionality for the duration of failure. This may be given as before_save, after_save, etc.
Validation institution settings: allow users to define the hooked up plugin settings.
Active document affiliation relationship: allows present day statistics to be actively having the relationship among each other.
Ruby Interview Questions
Question 34. Choosing Between Belongs_to And Has_one?
Answer :
If you need to installation a one-to-one courting between two fashions, you will need to add belongs_to to 1, and has_one to the other. How do you already know that's which?
The difference is in where you vicinity the overseas key (it is going at the table for the magnificence maintaining the belongs_to affiliation), however you must provide some notion to the real that means of the records as properly. The has_one dating says that considered one of something is yours - that is, that some thing points back to you. For example, it makes greater feel to say that a dealer owns an account than that an account owns a provider.
Question 35. Render Vs. Redirect_to In Ruby On Rails ?
Answer :
render will render a particular view the usage of the instance variables available within the motion.
For example if a render turned into used for the brand new movement, whilst a consumer is going to /new, the new action in the controller is called, instance variables are created and then exceeded to the new view. Rails creates the html for that view and returns it lower back to the user's browser. This is what you would recollect a regular web page load.
Redirect_to will ship a redirect to the consumer’s browser telling it to re-request a brand new URL as 302 redirect reaction. Then the browser will send a new request to that URL and it'll undergo the movement for that URL, oblivious to the reality that it was redirected to. None of the variables created within the movement that prompted the redirect can be to be had to the redirected view. This is what happens whilst you click on on ‘Create’ in a form and the item is created and also you’re redirected to the edit view for that item.
Question 36. What Is The Difference Between Save And Save?
Answer :
Save! Plays all validations and callbacks. If any validation returns false, save! Throws an mistakes and canceles the keep.
Save does no longer throw any blunders inside the case above, but canceles the store. Also, the validators can be bypassed.
Django Interview Questions
Question 37. What Is The Difference Between Delete And Destroy ?
Answer :
The delete method basically deletes a row (or an array of rows) from the database. Destroy however permits for some more options. First, it's going to check any callbacks along with before_delete, or any dependencies that we specify in our version. Next, it's going to maintain the object that just were given deleted in memory; this permits us to depart a message announcing something like “ 'Object_name' has been deleted.” Lastly, and most significantly, it's going to also delete any infant items associated with that object!
Question 38. What Are Filters? And How Many Types Of Filters Are There In Ruby ?
Answer :
Filters are strategies which can be run earlier than, after or "around" a controller action.
Filters are inherited, so if you set a filter on ApplicationController, it will be run on every controller on your software.
Filter can take one in all 3 forms: method reference (image), outside class, or inline approach (proc).
After_filter
append_after_filter
append_around_filter
append_before_filter
around_filter
before_filter
filter_chain
prepend_after_filter
prepend_around_filter
prepend_before_filter
skip_after_filter
skip_before_filter
skip_filter
Question 39. What Is The Flash?
Answer :
The flash is a special part of the session that's cleared with each request. This way that values stored there will simplest be to be had in the subsequent request, which is beneficial for storing mistakes messages and so forth. It is accessed in an awful lot the same way because the consultation, like a hash.
Flash is a item of Actiondispatch elegance.
Question 40. Difference Between Argument And Parameter In Ruby On Rails ?
Answer :
A parameter represents a cost that the method expects you to pass whilst you name it.
An argument represents the cost you pass to a technique parameter while you name the method. The calling code materials the arguments when it calls the technique.
In simple words, parameters appear in approach definitions; arguments seem in technique calls.
For example, in below technique, variables param1 and param2 are the parameters
def foo_method(param1, param2):
.......
Cease
while calling the approach, arg1 and arg2 are the arguments
foo_method(arg1, arg2)
Git (software program) Interview Questions
Question 41. What Is The Difference Between Symbol And String ?
Answer :
The image in Ruby on rails act the equal manner because the string but the distinction is in their behaviors which can be opposite to every other.
The distinction remains in the object_id, memory and system time for each of them while used together at one time.
Strings are considered as mutable items. Whereas, symbols, belongs to the class ofimmutable.
Strings objects are mutable so that it takes simplest the assignments to exchange the item facts. Whereas, data of, immutable gadgets gets overwritten.
-String gadgets are written like
"string object jack".Object_id #=>2250 or
"string item jack".To_sym.Object_id #=> 2260, and
"string object jack". To_s_object_id #=> 2270
Symbols are used to reveal the values for the actions like equality or non-equality to test the symbols faster then the string values.
Question 42. Write A Program To Show The Functionality Of Request.Xhr In Ruby On Rails ?
Answer :
Request from the request.Xhr presentations the controller that manages and creates the brand new AJAX that is being treated by the brand new controller.
The Boolean values that are retured have to generate best TRUE or FALSE. These values are was inserted for this reason.
The request.Xhr is being proven in a software proven beneath as:
def create
return except request.Xhr?
@imageable = find_imageable
@image = @imageable.Photographs.Build(params[:imageable])
@image.Shop
render :layout => fake
give up
Javascript Advanced Interview Questions
Question 43. What Are The Different Components Of Rails ?
Answer :
The components used in Rails are as follows:
Action Controller: it's far the element that manages all other controllers and technique the incoming request to the Rails utility.
It extracts the parameters and dispatches the reaction when an movement is executed on the software.
It presents services like consultation management, template rendering and redirect management.
Action View: it manages the views of the Rails application and it creates the output in both HTML and XML layout.
It additionally provides the control of the templates and offers the AJAX assist this is being used with the application.
Active Record: It offers the bottom platform for the models and gets used within the Rails software. It offers the database independence, CRUID functionality, seek functionality and putting the connection among exceptional fashions.
Action Mailer: It is a framework that provides email offerings to construct the platform on which flexible templates can be implemented.
Question forty four. What Is The Purpose Of Load, Auto_load, And Require_relative In Ruby ?
Answer :
Load lets in the method or a technique to be loaded within the reminiscence and it honestly processes the execution of the program used in a separate report.
It includes the instructions, modules, strategies and other files that executes within the cutting-edge scope this is being described. It plays the inclusion operation and reprocesses the whole code every time the burden is being known as.
Require is identical as load but it loads code most effective as soon as on first time.
Auto_load: this initiates the technique that is in hat document and allows the interpreter to name the approach.
Require_relative: allows the loading to take region of the nearby folders and documents.
Question 45. What Is A Proc ?
Answer :
Everyone normally confuses procs with blocks, but the most powerful rubyist can grok the real meaning of the question.
Essentially, Procs are anonymous techniques (or nameless features) containing code. They can be positioned internal a variable and exceeded around like another object or scalar fee. They are created by Proc.New, lambda, and blocks (invoked with the aid of the yield keyword).
Blocks are very accessible and syntactically easy, however we may also need to have many one of a kind blocks at our disposal and use them a couple of instances. As such, passing the equal block over and over would require us to repeat ourself. However, as Ruby is completely item-oriented, this may be handled pretty cleanly via saving reusable code as an item itself. This reusable code is known as aProc (quick for procedure). The simplest difference among blocks and Procs is that a block is a Proc that can't be saved, and as such, is a one time use solution.
Question forty six. What Is Unit Testing (in Classical Terms)? What Is The Primary Technique When Writing A Test ?
Answer :
Unit testing, clearly positioned, is trying out strategies -- the smallest unit in item-oriented programming. Strong applicants will argue that it permits a developer to flesh out their API before it's consumed by way of other structures inside the application.
The number one manner to attain that is to claim that the real end result of the method matches an expected end result.
Question 47. What Is The Difference Between Nil And False In Ruby ?
Answer :
False is a boolean datatype, Nil isn't a information kind it have object_id four.
Question 48. What Are The Looping Structures Available In Ruby ?
Answer :
for..In
untill..End
whilst..Stop
do..Give up
Note: You also can use each to iterate a array as loop no longer precisely like loop
Question 49. How Is Visibility Of Methods Changed In Ruby (encapsulation) ?
Answer :
By making use of the access modifier : Public , Private and Protected get entry to Modifier
Question 50. Dynamic Finders ?
Answer :
For each field (also known as an attribute) you outline for your desk, Active Record provides a finder method. If you've got a area referred to as first_name on your Client version as an example, you getfind_by_first_name and find_all_by_first_name without spending a dime from Active Record. If you have a locked field on the Client version, you also get find_by_locked and find_all_by_lockedmethods.
You also can use find_last_by_* methods for you to discover the ultimate report matching your argument.
You can specify an exclamation point (!) at the end of the dynamic finders to get them to raise an ActiveRecord::RecordNotFound mistakes if they do not go back any information, like Client.Find_by_name!("Ryan")
If you need to locate both by way of call and locked, you can chain those finders collectively by using without a doubt typing "and" among the fields. For example, Client.Find_by_first_name_and_locked("Ryan", authentic).
Question 51. Finding By Sql ?
Answer :
If you would like to apply your very own SQL to locate records in a desk you can use find_by_sql. The find_by_sql approach will go back an array of gadgets despite the fact that the underlying question returns just a unmarried document.
For instance you can run this question:
Client.Find_by_sql("SELECT * FROM clients
INNER JOIN orders ON clients.Identification = orders.Client_id ORDER customers.Created_at desc")
find_by_sql provides you with a simple way of creating custom calls to the database and retrieving instantiated objects.
Question fifty two. Pluck ?
Answer :
pluck may be used to question a unmarried column from the underlying desk of a version. It accepts a column name as argument and returns an array of values of the required column with the corresponding statistics type.
Client.Wherein(:lively => proper).Pluck(:identification)
# SELECT identity FROM clients WHERE lively = 1
Client.Uniq.Pluck(:position)
# SELECT DISTINCT role FROM clients
Question 53. Difference Between Rails 2 And Rails three ?
Answer :
I discovered 7 primary Difference between rails 2 and rails three has:
New Router Api,
New mailer,
New Active Record Query interface,
Assets pipeline,
Security Improvements,
Unobtrusive JavaScript (UJS) ,
Dependency management with bundler.
Question fifty four. What Is A Ruby Singleton Method ?
Answer :
A method which belongs to a single object rather than to an entire elegance and different objects.
Before explaining approximately singleton techniques I would love to offer a small creation approximately elegance strategies.
Class method: When you write your personal elegance strategies you achieve this by using prefacing the method call with the name of the elegance.
There are three approaches to write a class technique.
The first manner is to preface the class name with the approach call(ClassMethods.Method1).
The second manner is to preface the self key-word with the approach call(self.Method2).
The 0.33 manner is writing a sepetare elegance in the elegance which incorporates the methods (elegance << self).
Question fifty five. What Is Agile Development? What Are The Strengths?
Answer :
Agile software program improvement refers to a set of software improvement methodologies based on iterative development, wherein necessities and solutions evolve via collaboration among self-organizing move-functional groups
Advantages:
Customer pride by using fast, non-stop delivery of useful software Working software program is introduced frequently (weeks rather than months) Projects are built around prompted people, who ought to be relied on Continuous attention to technical excellence and accurate layout
Simplicity
Self-organizing groups
Regular edition to changing situations
Question fifty six. Difference Between Gem And Plugin?
Answer :
GEM
Gem is a packaged ruby utility using the packaging machine defined by using RubyGems.
Rails itself is a Gem
We can deploy,improve and question the gem version.
Gem installed for Ruby interpreter may be used device-extensive by that interpreter.
Plugin
Plugin is an extension of Rails Framework.
Can now not be upgraded by means of the usage of a command. To upgrade one have to uninstall and then deploy upgraded model.
Has to be hooked into rails software. (has to have init.Rb)
Have an install.Rb document. Five. Can handiest be used software extensive.
Question fifty seven. Difference Between Application Server And Web Server ?
Answer :
apache, nginx, IIS are web servers mongrel, webrick, phusion passenger are app servers
App server is some thing which works with unique programming language and parses and executes the code
for the reason that mongrel and webrick can best work with rails, so they may be app servers
Web servers are servers that could take the request from the browser.
Web servers usually works on port 80 though we are able to alternate the port in configuration
because mongrel and webrick can take that request at once, so that they may be notion of as net servers however web servers do have a whole lot of different functionality like request pipeline, load balancing and many others.
App servers lack those functionalities.
Question fifty eight. What Is The Use Of Load And Require In Ruby?
Answer :
A technique that hundreds and processes the Ruby code from a separate document, consisting of some thing lessons, modules, strategies, and constants are in that record into the current scope. Load is similar, but instead of appearing the inclusion operation once, it reprocesses the code on every occasion load is referred to as.
Question 59. Resource Routing & Difference Between Member Routes And Collection Routes ?
Answer :
Resource routing permits you to quick claim all of the common routes for a given creative controller. Instead of affirming separate routes to your index, show, new, edit, create, update and spoil movements, a ingenious direction announces them in a single line of code.
Browsers request pages from Rails through making a request for a URL the usage of a particular HTTP method, such as GET, POST, PUT and DELETE. Each approach is a request to perform an operation at the aid. A useful resource route maps some of related requests to moves in a single controller.
Question 60. How To Find Second Max Element From Database ?
Answer :
Rails Query:Model.Order("yourField DESC").Restrict(1).Offset(1)
Mysql: SELECT * FROM yourTable ORDER BY yourField DESC LIMIT 1,1;
Other square ways: -pick max(column_name) from table_name where column_name<(select max(column_name) from table_name)
-SELECT Name FROM Employees group BY Salary DESCENDING limit 2;
Question 61. What Is Rack ?
Answer :
Rack: a Ruby Webserver Interface
Rack middleware is a way to filter a request and response coming into your application.
Question 62. How Do I Find Only Duplicate Entries In A Database Table?
Answer :
Rails: User.Group(:email).Having("count(email)>1
Mysql: choose * from customers institution with the aid of first,e-mail having be counted(*) > 1

