Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Prepare Interview

Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Ruby On Rails Interview Questions and Answers

Ques 71. Is Rails Scalable?


Yes Rails gives you complete freedom to use all traditional means of scaling an application. Things like memcached, caching full pages, caching fragments are all supported. 

You can use any standard CDN to serve your media and static content as well. 

Database scaling using sharding is supported. 

Finally heroku makes your life easier by giving you the flexibility to scale up/down based on your need. Mostly websites have a peak time during which you need more servers and then there is a sleep time. Heroku makes that on-demand scaling process simpler. Companies such as makes the autoscale process easier.

Is it helpful? Add Comment View Comments
Ques 72. What are the key deployment challenges in Ruby on Rails?

heroku makes deployment easy.

Things that I sometimes run into are:

> Mismatched gem versions between local and production environment

> Some lessons learned:

Use image_tag helper each time

Specify root path in ENV variable

Configure assets pipeline by setting: config.assets.enabled = true in the config/application.rb file

Configure Capistrano script to precompile assets 

Is it helpful? Add Comment View Comments

Rails already has the logic built into it to prevent SQL injection attacks if you follow the right syntax. 

Say you are trying to authenticate a user based on their login and password you might be tempted to use a syntax as below:

User.first("login = '#{params[:name]}' AND password = '#{params[:password]}'")

If an attacker enters OR 1=1 as the name, and OR 2>1 as the password, the resulting SQL query will be:

 SELECT * FROM users WHERE login = '' OR '1'='1' AND password = '' OR '2'>'1' LIMIT 1 

This will simply find the first record in the database, and grants access to this user.

To prevent this type of SQL injection simply use the following format.

  User.where("login = ? AND password = ?", entered_user_name, entered_password).first


User.where(:login => entered_user_name, :password => entered_password).first
Is it helpful? Add Comment View Comments
Ques 74. How can you secure a Rails Application?

Rails has a lot of in-built capabilities to deal with common web-security issues. 

> SQL Injection

> Cross-Site 

> Session fixation and Session hijacking

> Captcha

Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2020 WithoutBook