Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Ruby On Rails Interview Questions and Answers

Ques 61. How can you implement internationalization in Ruby on Rails?

Ans.

Ruby ships with i18n which is an internationalization gem. 

You need to create locale files and save them under the config/locales directory as:

en.yml

es.yml

fr.yml

The keys should match for each of these files. 

en:   main_page:     hello: “Hello”     welcome: “Welcome to   My Company” es:   main_page:     hello: “Hola”     welcome: “Bienvenido a Mi Empresa” fr:   main_page:     hello: “Salut”     welcome: “Bienvenue   Mon Entreprise

In your code you would need to specify that the text would be locale specific. So change it to something like this:

.content   %h1     = t("main_page.hello")  
%p     = t("main_page.welcome")

Then you have to select the actual locale.

Is it helpful? Add Comment View Comments
Ques 62. WHAT PLUGIN WOULD YOU RECOMMEND FOR USER AUTHENTICATION AND AUTHORIZATION?
Ans.

Devise works great with Rails. 

It supports OAuth authentication and therefore integrates nicely with Facebook. 

Is it helpful? Add Comment View Comments
Ques 63. WHAT PLUGIN DO YOU USE FOR FULL-TEXT SEARCH in Ruby on Rails?
Ans.

Sunspot supports full-text search capability and uses Solr as the back-end search engine to do so. 

You would include these two plugins in your gem file as shown below:

gem 'sunspot_rails' 
gem 'sunspot_solr' 
Is it helpful? Add Comment View Comments
Ques 64. WHAT IS THE DIFFERENCE BETWEEN A PLUGIN AND A GEM in Ruby on Rails?
Ans.

A gem is just ruby code. It is installed on a machine and its available for all ruby applications running on that machine.

Rails, rake, json, rspec are all examples of gems. 

Plugin is also ruby code but it is installed in the application folder and only available for that specific application. 

Sitemap-generator, etc.

In general, since Rails works well with gems you will find that you would be mostly integrating with gem files and not plugins in general. Most developers release their libraries as gems. 

Is it helpful? Add Comment View Comments
Ques 65. HOW CAN YOU IMPLEMENT A SEARCH FEATURE THAT SEARCHES FOR MULTIPLE MODELS in Ruby on Rails?
Ans.

If you are using acts_as_solr for your search you will be able to use multi_solr_search to enable search across multiple models. 

Also, you can configure Sunspot/Solr to support search across multiple models.

Sphinx, another powerful search server can be used to search across multiple models and it works great. 

Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2016 WithoutBook