refacold.blogg.se

Interview questions on ruby on rails
Interview questions on ruby on rails











interview questions on ruby on rails

When migrating to a new version, self.up method is used while self.down method is used to roll back my changes if needed. 11) Mention what is the command to create a migration?Ĭ:\ruby\application>ruby script/generate migration table_name 12) Explain when self.up and self.down method is used?

interview questions on ruby on rails

Rails Migration enables Ruby to make changes to the database schema, making it possible to use a version control system to leave things synchronized with the actual code. Symbols are often used as the corresponding to enums in Ruby 10) Mention what is Rails Migration? Only one copy of the symbol requires to be created In Ruby string is mutable but a Symbol is immutable Symbol is different from variables in following aspects It is more like a string than variable 9) Explain how Symbol is different from variables? Symbol belongs to the category of immutable objects whereas Strings are considered as mutable objects. The difference lies in the object_id, memory, and process tune when they are used together. They both act in the same way only they differ in their behaviors which are opposite to each other. 8) Mention what is the difference between String and Symbol? The controller sub-directory is where Rails looks to find controller classesĪpp/helpers: The helper’s sub-directory holds any helper classes used to assist the view, model and controller classes. 7) 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. In Ruby, false is an object of FalseClass to represent a boolean value, while Nil is an object of NilClass which indicates the absence of a value. 6) Mention what the difference is between false and nil in Ruby? 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. 5) Explain what is ORM (Object-Relationship-Model) in Rails?

#Interview questions on ruby on rails code#

4) Explain what is “Yield” in Ruby on Rails?Ī Ruby method that receives a code block invokes it by calling it with the “Yield”. Rails: It is a framework used for building web application 2) Explain what is class libraries in Ruby?Ĭlass libraries in Ruby consist of a variety of domains, such as data types, thread programming, various domains, etc. Ruby on Rails 1) Explain what is Ruby on Rails? Ruby: It is an object-oriented programming language inspired by PERL, Smalltalk, Eiffel, Ada, Basic, and Lisp.













Interview questions on ruby on rails