It's just a change of philosophy between Rails 1 and Rails 2.Before Rails 2, we had file.rhtml, file.rxml and file.rjs.In Rails 2.0, that changed to file.content_type.template_engine. So with file.html.erb,the content type is html and the template engine is ERB. rxml is now xml.builder and rjs should now (mostly) be js.rjs.
2.What is dynamic database3.Difference between dynamic hasfinder and hasfinder
Most common operations in many applications is to simply query based on one or two columns, Rails has an easy and effective way to do these queries
without having to resort to the conditions parameter of find.Dynamic finder methods begin with find_by_name or find_all_by_name, indicating whether you want a single value or array of results returned. The semantics are simi-
lar to calling find with the :first versus the :all option.
>> City.find_by_name("Hackensack")
=> # "Hackensack", "latitude" =>"40.8858330000", "id" => "15942", "longitude" => "-74.0438890000","state" => "NJ" }>
>> City.find_all_by_name("Atlanta").collect(&:state)
=> ["GA", "MI", "TX"]
It's also possible to use multiple attributes in the same find by separating them with "and", so you get finders like Person.find_by_user_name_and_password or
even Payment.find_by_purchaser_and_state_and_country.
Has finder or named_scope is an extension to ActiveRecord that makes it easy to create custom finder and count methods on your ActiveRecord models. Read all about it at
Has finder
4.What is ORMwithout having to resort to the conditions parameter of find.Dynamic finder methods begin with find_by_name or find_all_by_name, indicating whether you want a single value or array of results returned. The semantics are simi-
lar to calling find with the :first versus the :all option.
>> City.find_by_name("Hackensack")
=> #
>> City.find_all_by_name("Atlanta").collect(&:state)
=> ["GA", "MI", "TX"]
It's also possible to use multiple attributes in the same find by separating them with "and", so you get finders like Person.find_by_user_name_and_password or
even Payment.find_by_purchaser_and_state_and_country.
Has finder or named_scope is an extension to ActiveRecord that makes it easy to create custom finder and count methods on your ActiveRecord models. Read all about it at
Has finder
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming language.Active Record is the object-relational mapping (ORM) layer supplied with Rails.Active Record closely follows the standard ORM model,ORM libraries map database tables to classes,
rows to objects, and columns to object attributes.
5.Tell briefly about Active Recordrows to objects, and columns to object attributes.
Read all about it at Active Record
6.What is Associations
Active Record associations declaratively express relationships between model classes. The power and readability of the Associations API is an important part of what makes working with Rails so special.Associations typically appear as methods on ActiveRecord model objects.
Associations are a set of macro-like class methods for tying objects together through foreign keys.Each macro adds a number of methods to the class which are specialized according to the collection or association symbol and the options hash. It works much the same way as Ruby‘s own attr* methods
7.What do you mean by polymorphic associationsAssociations are a set of macro-like class methods for tying objects together through foreign keys.Each macro adds a number of methods to the class which are specialized according to the collection or association symbol and the options hash. It works much the same way as Ruby‘s own attr* methods
Polymorphic relationships allow you to have a single model that can be associated to an arbitrary number of other model types.
8.What is HABTMA has_and_belongs_to_many association creates a direct many-to-many connection with another model, with no intervening model.
9.In HABTM, how will be the join table naming convention(For example Models User and Role)Join table will be as per alphabetical order, then the join table will be named as roles_user
10.What is meta programming11.What is Rspec
12.Tell briefly about RESTFUL Architecture
13.Difference between map.resources and map.resource
14.What is a block
15.Define Lambda & Proc
16.Difference between Lambda & Proc
17.Three levels of protection in ruby
18.Difference between protected method and private method
19.What is attr_accessor, attr_protected
20.How a website is working in Rails application
21.What is sessions and cookies
22.How sessions are storing
23.What is gem and difference between gem and plugin
24.What is TDD
25.What are callbacks
26.Why ruby is called as dynamic language
27.What is namespace
28.What is left join and outer join
29.How many engines mysql is having
30.What are called modules and what is the use of lib folder
Modules are a way of grouping together methods, classes, and constants. Modules give you two major benefits.
1. Modules provide a namespace and prevent name clashes.
2. Modules support the mixin facility.
Lib directory holds application code that doesn’t fit neatly into a model,
view, or controller.The lib directory is also a good place to put code that’s shared among models,views, or controllers.If the file is in the lib directory
itself, you require it directly by name.
31.How to provide grant permission for mysql1. Modules provide a namespace and prevent name clashes.
2. Modules support the mixin facility.
Lib directory holds application code that doesn’t fit neatly into a model,
view, or controller.The lib directory is also a good place to put code that’s shared among models,views, or controllers.If the file is in the lib directory
itself, you require it directly by name.
GRANT ALL PRIVILEGES ON my_database.* TO 'my_user'@'localhost' IDENTIFIED BY 'my_password' WITH GRANT OPTION;
32.Difference between single quote and double quote in rubySingle-quoted strings are treated as literals; double-quoted strings are interpolated.Single quotes will print the value whereas double quotes will execute it.
For example
>> r = 42
=> 42
>> "#{r}"
=> "42"
>> '#{r}'
=> "\#{r}"
33.Why ruby?For example
>> r = 42
=> 42
>> "#{r}"
=> "42"
>> '#{r}'
=> "\#{r}"
Most enterprise software running today was written in languages such as COBOL, C/C++, and Java. Because of its distributed nature, enterprise software often makes it easy to use new tools and programminglanguages. When you have to create a small standalone application one that only relies upon an existing database, SOAP service, or LDAP repository—it almost doesn’t seem to matter if you were to write it in C++, Java, or Ruby. But if you look into it more deeply, dynamic languages such as Perl, Python, and Ruby have many of advantages, especially in enterprise environments:
• They are interpreted and do not need a compile phase, which increases development speed tremendously. After editing your program you can see the results of your changes immediately.
• Enterprise software is about munging data. Dynamic languages are designed to handle data, and include high-level data types such as hashes.
• Memory management is dealt with by the language. This is a great advantage over languages such as C++ where you have to specify the length of each string you read from a database. Dynamic languages prevent waste and result in more concise, more robust,and more secure software.
• Software written in dynamic languages is installed as source code,so you always know exactly which version is currently running on your production system. Gone are the days when you had to guess if a certain binary executable is the right one.
• They are interpreted and do not need a compile phase, which increases development speed tremendously. After editing your program you can see the results of your changes immediately.
• Enterprise software is about munging data. Dynamic languages are designed to handle data, and include high-level data types such as hashes.
• Memory management is dealt with by the language. This is a great advantage over languages such as C++ where you have to specify the length of each string you read from a database. Dynamic languages prevent waste and result in more concise, more robust,and more secure software.
• Software written in dynamic languages is installed as source code,so you always know exactly which version is currently running on your production system. Gone are the days when you had to guess if a certain binary executable is the right one.
Note* : This post will get updated
Uhm.. There is no content on this page other than list of questions. I expect that an FAQ would include the answers as well. Exactly how is this going to help anyone?
ReplyDeleteThanks for your reply, i will update the answers soon
ReplyDeletemaybe turn this into a wiki where you get community contributed answers.
ReplyDelete