Home / Interview / Rails :: General Questions

Interview :: Rails

41)

What are Rails validation used for?

Rails validation defines valid states for each of your Active Record model classes. They are used to ensure that only valid details are entered into your database.

42)

Explain valid and invalid in Rails?

The valid? triggers your validations and returns true if no errors are found otherwise, false.

The invalid? is simply the reverse of valid?. It triggers your validations and returns true if invalid otherwise, false.

43)

Explain Unobtrusive JavaScript in Rails?

"Unobtrusive JavaScript" technique is considered as the best technique within the frontend community.

44) What is Action Cable?

It is a framework which is used to extend Rails via WebSockets to add some functionality. It integrates WebSockets with the rest of the Rails application very smoothly. It allows you to add some real-time features to your app quickly.

45)

Explain the various IDE's of ruby on rails?

TextMate:The TextMate is mainly used for the Mac operating system. It allows you to write extensions to the base environment. The extensions plug into TextMate to add new features to the base editor. These extensions are called Bundles.

E:The E-text editor is built just like TextMate editor to work on Windows. It replicates many features of the TextMate and even allows to use the TextMate bundles.

IntelliJ IDEA:The IntelliJ IDEA is a commercial IDE made of JetBrains. Earlier, it was also used for Java development. JetBrains version 7.0 has added Rails support to the IntelliJ IDEA.

NetBeans:The NetBeans is an IDE from Sun. Earlier, it was used for Java development. Sun version 7.0 has added Rails support to the NetBeans.

Eclipse:The Eclipse IDE is the most commonly used IDE today. Using a plug-in RadRails, you can add Rails support entirely to the Eclipse environment.

Heroku:The Heroku IDE provides a new and unique way of writing Rails application. It is used entirely online to develop applications. You do not need to install any software on your system to use Heroku. It does not support Internet Explorer.

Aptana Studio:A product from Aptana is a stand-alone desktop IDE based on Eclipse project. It is quite similar to Eclipse. The Rails features are packaged as a plug-in to the Aptana Studio environment.

RubyMine:The RubyMine IDE is a preferable choice for Rubyists. It provides many extra features than other IDEs. One feature it includes clicks and follows. When you click on a function, it will take you to the function being called. This feature comes in handy when multiple functions share the same name and reside in different files and folder. The other features are Git annotate and Git compare.

46) What is the rail console?

The Rails console is a command line utility which runs Rails application from the command line. The Rails console is an extension of Ruby IRB. It provides all the features of IRB along with the ability to auto-load Rails application environment, including all its classes and components. It helps you to walk through your application step-by-step.

47) What are generators in ruby on rails?

The rails include code generator scripts, which are used to generate model and controller classes for an application automatically. Code generation increases your productivity when developing web applications. By running generator command, skeleton files for all your model and controller classes will be generated. It also generates database migration files for each model it generates.

48) What is a webrick web server?

Rails are configured to use WEBrick server automatically. This server is written in pure Ruby and supports almost all platforms like Windows, Mac or Unix. Alternatively, if you have Mongrel or Lighttpd server installed in your system, Rails uses either of those servers.

All the three Rails servers feature automatic reloading of code. It means, when you change your source code, you do not need to restart the server.