{
"iq":[{"id":"1",
"q":"What Is Rails?",
"answer":"Rails is a extremely productive web-application framework written in Ruby language by David Hansson.\n\nRails are an open source Ruby framework for developing database-backend web applications.\n\nRails include everything needed to create a database-driven web application using the Model-View-Controller (MVC) pattern. "
},
{"id":"2",
"q":"what is Ruby on Rails?",
"answer":"Ruby: It is an object oriented programming language inspired by PERL and PYTHON.\n\nRails: It is a framework used for building web application"
},
{"id":"3",
"q":"Explain what is class libraries in Ruby?",
"answer":"Class libraries in Ruby consist of a variety of domains, such as data types, thread programming, various domains, etc."
},
{"id":"4",
"q":"Explain what is “Yield” in Ruby on Rails?",
"answer":"A Ruby method that receives a code block invokes it by calling it with the “Yield”."
},
{"id":"5",
"q":" Explain what is ORM (Object-Relationship-Model) in Rails?",
"answer":"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."
},
{"id":"6",
"q":"Mention what the difference is between false and nil in Ruby?",
"answer":"In Ruby False indicates a Boolean datatype, while Nil is not a data type, it have an object_id 4."
},
{"id":"7",
"q":"What Do You Mean By Render And Redirect_to?",
"answer":" render causes rails to generate a response whose content is provided by rendering one of your templates. Means, it will direct goes to view page. redirect_to generates a response that, instead of delivering content to the browser, just tells it to request another url. Means it first checks actions in controller and then goes to view page. "
},
{"id":"8",
"q":"What Is Orm In Rails?",
"answer":"ORM tends for Object-Relationship-Model, where Classes are mapped to table in the database, and Objects are directly mapped to the rows in the table."
},
{"id":"9",
"q":"How Many Types Of Associations Relationships Does A Model Have?",
"answer":"When you have more than one model in your rails application, you would need to create connection between those models. You can do this via associations. Active Record supports three types of associations:\n\none-to-one: A one-to-one relationship exists when one item has exactly one of another item. For example, a person has exactly one birthday or a dog has exactly one owner.\n\none-to-many: A one-to-many relationship exists when a single object can be a member of many other objects. For instance, one subject can have many books.\n\nmany-to-many: A many-to-many relationship exists when the first object is related to one or more of a second object, and the second object is related to one or many of the first object."
},
{"id":"10",
"q":"What Are Helpers And How To Use Helpers In Ror?",
"answer":"Helpers are modules that provide methods which are automatically usable in your view.They provide shortcuts to commonly used display code and a way for you to keep the programming out of your views.The purpose of a helper is to simplify the view."
},
{"id":"11",
"q":"What Are Filters?",
"answer":"Filters are methods that run “before”, “after” or “around” a controller action. Filters are inherited, so if you set a filter on ApplicationController, it will be run on every controller in your application."
},
{"id":"12",
"q":"What Is Mvc? And How It Works?",
"answer":"MVC tends for Model-View-Controller, used by many languages like PHP, Perl, Python etc. The flow goes like this:\n\nRequest first comes to the controller, controller finds and appropriate view and interacts with model, model interacts with your database and send the response to controller then controller based on the response give the output parameter to view."
},
{"id":"13",
"q":"What Is Session And Cookies?",
"answer":" Session is used to store user information on the server side. Maximum size is 4 kb. Cookies are used to store information on the browser side or we can say client side."
},
{"id":"14",
"q":"What Is Request.xhr?",
"answer":"A request.xhr tells the controller that the new Ajax request has come, It always return Boolean values (TRUE or FALSE)"
},
{"id":"15",
"q":" HOW CAN YOU SECURE A RAILS APPLICATION?",
"answer":"Rails has a lot of in-built capabilities to deal with common web-security issues.\n\nSQL Injection\n\nCross-Site\n\nSession fixation and Session hijacking\n\nCaptcha "
},
{"id":"16",
"q":"WHERE WOULD YOU REACH OUT TO GET THE COMMUNITY TO ANSWER YOUR QUESTIONS?",
"answer":"Stackoverflow and meetup groups. "
},
{"id":"17",
"q":"HOW CAN YOU CREATE BREADCRUMBS ON YOUR PAGES?",
"answer":"IGretel is a great plugin to introduce breadcrumbs in your Rails application.Another very simple implementation is breadcrumb_on_rails. "
},
{"id":"18",
"q":" WHAT PLUGIN DO YOU USE FOR FULL-TEXT SEARCH? ",
"answer":"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:\n\ngem 'sunspot_rails'\n\ngem 'sunspot_solr' "
},
{"id":"19",
"q":"HOW CAN YOU INSTALL THE MISSING GEMS THAT ARE REQUIRED BY YOUR APPLICATION IN THE SIMPLEST WAY?",
"answer":" bundle install"
},
{"id":"20",
"q":"HOW CAN YOU ACHIEVE THE SAME EFFECT AS MULTIPLE INHERITANCE USING RUBY? WHAT IS MIXIN?",
"answer":"Ruby offers a very neat alternative concept called mixin. Modules can be imported inside other class using mixin. They are then mixed-in with the class in which they are imported.\n\nHere’s an example:\n\nmodule Debug\n\ndef whoAmI?\n\n\"I am #{self.to_s}\"\n\nend\n\nend\n\nclass Photo\n\ninclude Debug\n\nend\n\nph = Photo.new\n\n\"I am : #<Photo:0x007f8ea218b270>\"\n\nAs you can see above the class Debug and it’s method “whoamI?” were mixed-in (added) with the class Photo.\n\nThat’s why you can now create an instance of the Photo class and call the whoAmI? method.\n\nph.whoAmI?\n\n=> \"I am : #<Phonograph:0x007f8ea218b270>\" "
},
{"id":"21",
"q":"What is agile development",
"answer":"Agile methodology is anadaptaive methodology, its people oriented.\n\nHere are some of the other characteristices of the Agile methodology.\n\n1. Delivery frequently.\n\n2. Good ROI for client.\n\n3. Test frequently.\n\n4. Collaborative approach.\n\nAgile methodology is on daily basis report.\n\nHow much work we have completed on that day and how much work is still pending… it gives the clear picture but the req are not defined beforehanditself completely.. req will be changing… "
},
{"id":"22",
"q":"What is Ruby Gems?",
"answer":"Ruby Gem is a software package, commonly called a “gem”.Gem contains a packaged Ruby application or library.The Ruby Gems software itself allows you to easily download, install and manipulate gems on your system. "
},
{"id":"23",
"q":"What is Gemfile and Gemfile.lock?",
"answer":"The Gemfile is where you specify which gems you want to use, and lets you specify which versions.\n\nThe Gemfile.lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.lock and install the exact same versions, rather than just using the Gemfile and installing the most recent versions.(Running different versions on different machines could lead to broken tests, etc.) You shouldn’t ever have to directly edit the lock file."
},{"id":"24",
"q":" What is Active record ",
"answer":"There are many reasons why Active Record is the smart choice\n\nSimplified configuration and default assumptions (Convention over Configuration).\n\nAssociations among objects.\n\nAutomated mapping b/w tables and classes and b/w columns and attributes.\n\nData Validations.\n\nCallbacks\n\nInheritance hierarchies.\n\nDirect manipulation of data as well as schema objects.\n\nDatabase abstraction through adapters.\n\nLogging support.\n\nMigration support.\n\nActive Record integrated in other emerging frameworks like Merb."
},{"id":"25",
"q":"How you run your Rails application without creating databases?",
"answer":"You can run your application by uncommenting the line in environment.rb\n\npath=> rootpath conf/environment.rb\n\nconfig.frameworks- = [action_web_service, :action_mailer, :active_record"
},{"id":"26",
"q":"What are the servers supported by ruby on rails?",
"answer":"Ruby Supports a number of Rails servers (Mongrel, WEBRICK, PHUSION, Passenger, etc..depending on the specific platforms).\n\nFor each Rails application project, RubyMine provides default Rails run/debug configurations for the production and development environments."
},{"id":"27",
"q":"What is restful in rails",
"answer":"Stands for REpresentational State Transfer"
},{"id":"28",
"q":"What is passanger ",
"answer":"Easy and robust deployment of ruby on rails app on appache and ngix webservers passenger is an intermediate to run the ruby language in linux server"
},{"id":"29",
"q":"What is the Difference between Static and Dynamic Scaffolding? ",
"answer":"The Syntax of Static Scaffold is like this:\n\nruby script/generate scaffold User Comment Where Comment is the model and User is your controller, So all n all static scaffold takes\n\n2 parameter i.e your controller name and model name, whereas in dynamic scaffolding you have to define controller and model one by one."
},{"id":"30",
"q":" What is the difference between form_for and form_tag",
"answer":"form_tag and form_for both are used to submit the form and it’s elements.The main difference between these two is the way of managing objects related to that particular model is different.\n\nform_for\n\n——-\n\nWe should use “form_for” tag for a specific model\n\nIt performs the “standard http post” which is having fields related to active record (model) objects\n\nform_tag:\n\n—–\n\nIt creates a form as a normal form. form_tag also performs the “standard http post” without any model backed and has normal fields. This is mainly used when specific data need to be submitted via form.\n\nIt just creates a form tag and it is best used for non-model forms.\n\nExample:\n\n<% form_tag ‘/articles’ do -%>\n\n<%= text_field_tag “article”, “firstname” %>\n\n<% end -%>"
},{"id":"31",
"q":"Explain how Rails implements Ajax? ",
"answer":"Ajax powered web page retrieves the web page from the server which is new or changed unlike other web-page where you have to refresh the page to get the latest information.\n\nRails triggers an Ajax Operation in following ways\n\n\nSome trigger fires: The trigger could be a user clicking on a link or button, the users inducing changes to the data in the field or on a form\n\nWeb client calls the server: A Java-script method, XMLHttpRequest, sends data linked with the trigger to an action handler on the server. The data might be the ID of a checkbox, the whole form or the text in the entry field\n\nServer does process: The server side action handler does something with the data and retrieves an HTML fragment to the web client\n\nClient receives the response: The client side JavaScript, which Rails generates automatically, receives the HTML fragment and uses it to update a particular part of the current"
},{"id":"32",
"q":" Mention how you can create a controller for subject?",
"answer":"To create a controller for subject you can use the following command\n\nC:\ruby\library> ruby script/generate controller subject "
},{"id":"33",
"q":" Mention what is Rails Migration?",
"answer":"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."
},{"id":"34",
"q":" Mention what is the command to create a migration?",
"answer":"To create migration command includes\n\nC:\ruby\application>ruby script/generate migration table_name"
},{"id":"35",
"q":" Explain when self.up and self.down method is used?",
"answer":"When migrating to a new version, self.up method is used while self.down method is used to roll back my changes if needed."
},{"id":"36",
"q":" Mention what is the role of Rails Controller?",
"answer":"The Rails controller is the logical center of the application. It faciliates the interaction between the users, views, and the model. It also performs other activities like\n\nIt is capable of routing external requests to internal actions. It handles URL extremely well\n\nIt regulates helper modules, which extend the capabilities of the view templates without bulking of their code\n\nIt regulates sessions; that gives users the impression of an ongoing interaction with our applications"
},{"id":"37",
"q":" Mention what is the difference between Active support’s “HashWithIndifferent” and Ruby’s “Hash” ?",
"answer":"The Hash class in Ruby’s core library returns value by using a standard “= =” comparison on the keys.\n\nIt means that the value stored for a symbol key cannot be retrieved using the equivalent string.\n\nWhile the HashWithIndifferentAccess treats Symbol keys and String keys as equivalent. "
},{"id":"38",
"q":" Explain what is Cross-Site Request Forgery (CSRF) and how Rails is protected against it?",
"answer":"CSRF is a form of attack where hacker submits a page request on your behalf to a different website, causing damage or revealing your sensitive data. To protect from CSRF attacks, you have to add “protect_from_forgery” to your ApplicationController. This will cause Rails to require a CSRF token to process the request. CSRF token is given as a hidden field in every form created using Rails form builders."
},{"id":"39",
"q":"Explain what is Mixin in Rails? ",
"answer":"Mixin in Ruby offers an alternative to multiple inheritances, using mixin modules can be imported inside other class."
},{"id":"40",
"q":" Explain how you can run Rails application without creating databases?",
"answer":"You can execute your application by uncommenting the line in environment.rb\n\npath=> rootpath conf/environment.rb\n\nconfig.frameworks = [ action_web_service, :action_mailer, :active_record]"
},{"id":"41",
"q":"Explain what is rake in Rails? ",
"answer":"Rake is a Ruby Make; it is a Ruby utility that substitutes the Unix utility ‘make’, and uses a ‘Rakefile’ and ‘.rake files’ to build up a list of tasks. In Rails, Rake is used for normal administration tasks like migrating the database through scripts, loading a schema into the database, etc."
},{"id":"42",
"q":" Explain what is sweeper in Rails? ",
"answer":"Sweepers are responsible for expiring or terminating caches when model object changes."
},{"id":"43",
"q":"Mention the log that has to be seen to report errors in Ruby Rails?·",
"answer":"Rails will report errors from Apache in the log/Apache.log and errors from the Ruby code in log/development.log."
},{"id":"44",
"q":"Mention what is the purpose of RJs in Rails?",
"answer":" RJs is a template that produces JavaScript which is run in an eval block by the browser in response to an AJAX request. It is sometimes used to define the JavaScript, Prototype and helpers provided by Rails."
},{"id":"45",
"q":" What is the difference between include and extend",
"answer":"include makes the module’s methods available to the instance of a class, while extend makes these methods available to the class itself."
},{"id":"46",
"q":"How to call method dynamically",
"answer":"[“foo”, “bar”].each do |method|\n\nMyClass.send(method)\n\nend"
},{"id":"47",
"q":"How to use Nested routes in ROR",
"answer":"The easiest way to create a nested route, is to use the :has_many keyword like that:\n\n# /config/routes.rb\n\nmap.resources :projects, :has_many => :tasks\n\n# and the correspondent task resource\n\nmap.resources :tasks\n\nAdding the second routes, that defines a RESTful route to :tasks, depends if you would like to allow an access to the Task resource,without the project context, this is not a must."
},{"id":"48",
"q":" What things we can define in the model?",
"answer":"There are lot of things you can define in models few are:\n\n1. Validations (like validates_presence_of, numeracility_of, format_of etc.)\n\n2. Relationships(like has_one, has_many, HABTM etc.)\n\n3. Callbacks(like before_save, after_save, before_create etc.)\n\n4. Suppose you installed a plugin say validation_group, So you can also define validation_group settings in your model\n\n5. ROR Queries in Sql"
},
{"id":"49",
"q":"What is asset pipeline",
"answer":"asset pipeline which enables proper organization of CSS and JavaScript "
},{"id":"50",
"q":"What Is Tdd And Bdd? ",
"answer":"TDD stands for Test-Driven-Development and BDD stands for Behavior-Driven-Development."
},{"id":"51",
"q":"What Are The Servers Supported By Ruby On Rails? ",
"answer":"RoR was generally preferred over WEBrick server at the time of writing, but it can also be run by:Lighttpd (pronounced ‘lighty’) is an open-source web server more optimized for speed-critical environments.\n\nAbyss Web Server- is a compact web server available for windows, Mac osX and Linux operating system. Apache and nginx "
},
{"id":"52",
"q":"What is the Default Session state mode?",
"answer":" The default Session state mode is INPROC. "
},
{"id":"53",
"q":"How to set the life time of session variable? ",
"answer":"Using TimeOut property. "
},
{"id":"54",
"q":"Explain about Dig, Float and Max?",
"answer":"Float class is used whenever the function changes constantly.\n\nDig is used whenever you want to represent a float in decimal digits.\n\nMax is used whenever there is a huge need of Float."
},{"id":"55",
"q":"Mention the types of variables available in Ruby Class? ",
"answer":"Types of variables available in Ruby Class are,\n\nLocal Variables\n\nGlobal Variables\n\nClass Variables\n\nInstance Variables"
},{"id":"56",
"q":"Explain how can you declare a block in Ruby?",
"answer":" In Ruby, the code in the block is always enclosed within braces ({}). You can invoke a block by using “yield statement”."
},{"id":"57",
"q":"Explain what is the difference between put and putc statement?",
"answer":"Unlike the puts statement, which outputs the entire string onto the screen. The Putc statement can be used to output one character at a time."
},{"id":"58",
"q":"Mention what is the difference extend and include? ",
"answer":"The “include” makes the module’s methods available to the instance of a class, while “extend” makes these methods available to the class itself."
},{"id":"59",
"q":"Mention what is the difference between a single quote and double quote? ",
"answer":"A single-quoted strings don’t process ASCII escape codes, and they don’t do string interpolation."
},{"id":"60",
"q":"Mention what is the difference between a gem and a plugin in Ruby? ",
"answer":"Gem: A gem is a just ruby code. It is installed on a machine, and it’s available for all ruby applications running on that machine.\n\nPlugin: Plugin is also ruby code, but it is installed in the application folder and only available for that specific application."
},{"id":"61",
"q":"How many types of callbacks available in ROR? ",
"answer":"* (-) save\n\n* (-) valid\n\n* (1) before_validation\n\n* (2) before_validation_on_create\n\n* (-) validate\n\n* (-) validate_on_create\n\n* (3) after_validation\n\n* (4) after_validation_on_create\n\n* (5) before_save\n\n* (6) before_create\n\n* (-) create\n\n* (7) after_create\n\n* (8) after_save"
},
{"id":"62",
"q":" What is bundler? ",
"answer":"Bundler is a new concept introduced in Rails3,which helps to you manage your gems for the application. After specifying gems in your Gemfile, you need to do a bundle install.If the gem is available in the system, bundle will use that else it will pick up from the rubygems.org."
},
{"id":"63",
"q":"What is the Newest approach for find(:all) in Rails 3?",
"answer":"Model.where(:activated => true)"
},
{"id":"64",
"q":"What is eagerloading",
"answer":"One way to improve performance is to reduce the number of database queries through eager loading.You can know where we need eager loading through “Bullet’ Gem"
},
{"id":"65",
"q":" Difference between render and redirect?",
"answer":"Redirect is a method that is used to issue the error message in case the page is not found or it issues a 302 to the browser. Whereas, render is a method used to create the content.\n\n-Redirect is used to tell the browser to issue a new request. Whereas, render only works in case the controller is being set up properly with the variables that needs to be rendered.\n\n-Redirect is used when the user needs to redirect its response to some other page or URL. Whereas, render method renders a page and generate a code of 200.\n\n-Redirect is used as:\n\nredirect_to: controller => ‘users’, :action => ‘new’\n\n-Render is used as:\n\nrender: partial\n\nrender: new -> this will call the template named as new.rhtml without the need of redirecting it to the new action."
},
{"id":"66",
"q":"What is the use of Global Variable in Ruby?",
"answer":"Syntatically, a global variable is a variable whose name begins with $\n\nGlobal variables in Ruby are accessible from anywhere in the Ruby program, regardless of where they are declared.\n\n$welcome = “Welcome to Ruby Essentials”"
},
{"id":"67",
"q":"What is the use of load and require in Ruby?",
"answer":"The require() method is quite similar to load(), but it’s meant for a different purpose.\n\nYou use load() to execute code, and you use require() to import libraries."
},
{"id":"68",
"q":"What is the Notation used for denoting class variables in Ruby?",
"answer":"We can know a variable as “Class variable’s” if its preceeded by @@ symbols."
},
{"id":"69",
"q":"What is the use of Destructive Method?",
"answer":"Distructive methods are used to change the object value permanently by itself using bang (!) operator.\n\n‘sort’ returns a new array and leaves the original unchanged.\n\n‘sort!’ returns the same array with the modification.\n\nThe ‘!’ indicates it’s a destructive method. It will overwrite the current array with the new result and returns it. "
},
{"id":"70",
"q":" What are the engines in mysql.?",
"answer":"In previous versions of MySQL, MyISAM was the default storage engine.\n\nIn our experience, most users never changed the default settings. With MySQL 5.5, InnoDB becomes the default storage engine. "
}
]
}
"iq":[{"id":"1",
"q":"What Is Rails?",
"answer":"Rails is a extremely productive web-application framework written in Ruby language by David Hansson.\n\nRails are an open source Ruby framework for developing database-backend web applications.\n\nRails include everything needed to create a database-driven web application using the Model-View-Controller (MVC) pattern. "
},
{"id":"2",
"q":"what is Ruby on Rails?",
"answer":"Ruby: It is an object oriented programming language inspired by PERL and PYTHON.\n\nRails: It is a framework used for building web application"
},
{"id":"3",
"q":"Explain what is class libraries in Ruby?",
"answer":"Class libraries in Ruby consist of a variety of domains, such as data types, thread programming, various domains, etc."
},
{"id":"4",
"q":"Explain what is “Yield” in Ruby on Rails?",
"answer":"A Ruby method that receives a code block invokes it by calling it with the “Yield”."
},
{"id":"5",
"q":" Explain what is ORM (Object-Relationship-Model) in Rails?",
"answer":"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."
},
{"id":"6",
"q":"Mention what the difference is between false and nil in Ruby?",
"answer":"In Ruby False indicates a Boolean datatype, while Nil is not a data type, it have an object_id 4."
},
{"id":"7",
"q":"What Do You Mean By Render And Redirect_to?",
"answer":" render causes rails to generate a response whose content is provided by rendering one of your templates. Means, it will direct goes to view page. redirect_to generates a response that, instead of delivering content to the browser, just tells it to request another url. Means it first checks actions in controller and then goes to view page. "
},
{"id":"8",
"q":"What Is Orm In Rails?",
"answer":"ORM tends for Object-Relationship-Model, where Classes are mapped to table in the database, and Objects are directly mapped to the rows in the table."
},
{"id":"9",
"q":"How Many Types Of Associations Relationships Does A Model Have?",
"answer":"When you have more than one model in your rails application, you would need to create connection between those models. You can do this via associations. Active Record supports three types of associations:\n\none-to-one: A one-to-one relationship exists when one item has exactly one of another item. For example, a person has exactly one birthday or a dog has exactly one owner.\n\none-to-many: A one-to-many relationship exists when a single object can be a member of many other objects. For instance, one subject can have many books.\n\nmany-to-many: A many-to-many relationship exists when the first object is related to one or more of a second object, and the second object is related to one or many of the first object."
},
{"id":"10",
"q":"What Are Helpers And How To Use Helpers In Ror?",
"answer":"Helpers are modules that provide methods which are automatically usable in your view.They provide shortcuts to commonly used display code and a way for you to keep the programming out of your views.The purpose of a helper is to simplify the view."
},
{"id":"11",
"q":"What Are Filters?",
"answer":"Filters are methods that run “before”, “after” or “around” a controller action. Filters are inherited, so if you set a filter on ApplicationController, it will be run on every controller in your application."
},
{"id":"12",
"q":"What Is Mvc? And How It Works?",
"answer":"MVC tends for Model-View-Controller, used by many languages like PHP, Perl, Python etc. The flow goes like this:\n\nRequest first comes to the controller, controller finds and appropriate view and interacts with model, model interacts with your database and send the response to controller then controller based on the response give the output parameter to view."
},
{"id":"13",
"q":"What Is Session And Cookies?",
"answer":" Session is used to store user information on the server side. Maximum size is 4 kb. Cookies are used to store information on the browser side or we can say client side."
},
{"id":"14",
"q":"What Is Request.xhr?",
"answer":"A request.xhr tells the controller that the new Ajax request has come, It always return Boolean values (TRUE or FALSE)"
},
{"id":"15",
"q":" HOW CAN YOU SECURE A RAILS APPLICATION?",
"answer":"Rails has a lot of in-built capabilities to deal with common web-security issues.\n\nSQL Injection\n\nCross-Site\n\nSession fixation and Session hijacking\n\nCaptcha "
},
{"id":"16",
"q":"WHERE WOULD YOU REACH OUT TO GET THE COMMUNITY TO ANSWER YOUR QUESTIONS?",
"answer":"Stackoverflow and meetup groups. "
},
{"id":"17",
"q":"HOW CAN YOU CREATE BREADCRUMBS ON YOUR PAGES?",
"answer":"IGretel is a great plugin to introduce breadcrumbs in your Rails application.Another very simple implementation is breadcrumb_on_rails. "
},
{"id":"18",
"q":" WHAT PLUGIN DO YOU USE FOR FULL-TEXT SEARCH? ",
"answer":"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:\n\ngem 'sunspot_rails'\n\ngem 'sunspot_solr' "
},
{"id":"19",
"q":"HOW CAN YOU INSTALL THE MISSING GEMS THAT ARE REQUIRED BY YOUR APPLICATION IN THE SIMPLEST WAY?",
"answer":" bundle install"
},
{"id":"20",
"q":"HOW CAN YOU ACHIEVE THE SAME EFFECT AS MULTIPLE INHERITANCE USING RUBY? WHAT IS MIXIN?",
"answer":"Ruby offers a very neat alternative concept called mixin. Modules can be imported inside other class using mixin. They are then mixed-in with the class in which they are imported.\n\nHere’s an example:\n\nmodule Debug\n\ndef whoAmI?\n\n\"I am #{self.to_s}\"\n\nend\n\nend\n\nclass Photo\n\ninclude Debug\n\nend\n\nph = Photo.new\n\n\"I am : #<Photo:0x007f8ea218b270>\"\n\nAs you can see above the class Debug and it’s method “whoamI?” were mixed-in (added) with the class Photo.\n\nThat’s why you can now create an instance of the Photo class and call the whoAmI? method.\n\nph.whoAmI?\n\n=> \"I am : #<Phonograph:0x007f8ea218b270>\" "
},
{"id":"21",
"q":"What is agile development",
"answer":"Agile methodology is anadaptaive methodology, its people oriented.\n\nHere are some of the other characteristices of the Agile methodology.\n\n1. Delivery frequently.\n\n2. Good ROI for client.\n\n3. Test frequently.\n\n4. Collaborative approach.\n\nAgile methodology is on daily basis report.\n\nHow much work we have completed on that day and how much work is still pending… it gives the clear picture but the req are not defined beforehanditself completely.. req will be changing… "
},
{"id":"22",
"q":"What is Ruby Gems?",
"answer":"Ruby Gem is a software package, commonly called a “gem”.Gem contains a packaged Ruby application or library.The Ruby Gems software itself allows you to easily download, install and manipulate gems on your system. "
},
{"id":"23",
"q":"What is Gemfile and Gemfile.lock?",
"answer":"The Gemfile is where you specify which gems you want to use, and lets you specify which versions.\n\nThe Gemfile.lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.lock and install the exact same versions, rather than just using the Gemfile and installing the most recent versions.(Running different versions on different machines could lead to broken tests, etc.) You shouldn’t ever have to directly edit the lock file."
},{"id":"24",
"q":" What is Active record ",
"answer":"There are many reasons why Active Record is the smart choice\n\nSimplified configuration and default assumptions (Convention over Configuration).\n\nAssociations among objects.\n\nAutomated mapping b/w tables and classes and b/w columns and attributes.\n\nData Validations.\n\nCallbacks\n\nInheritance hierarchies.\n\nDirect manipulation of data as well as schema objects.\n\nDatabase abstraction through adapters.\n\nLogging support.\n\nMigration support.\n\nActive Record integrated in other emerging frameworks like Merb."
},{"id":"25",
"q":"How you run your Rails application without creating databases?",
"answer":"You can run your application by uncommenting the line in environment.rb\n\npath=> rootpath conf/environment.rb\n\nconfig.frameworks- = [action_web_service, :action_mailer, :active_record"
},{"id":"26",
"q":"What are the servers supported by ruby on rails?",
"answer":"Ruby Supports a number of Rails servers (Mongrel, WEBRICK, PHUSION, Passenger, etc..depending on the specific platforms).\n\nFor each Rails application project, RubyMine provides default Rails run/debug configurations for the production and development environments."
},{"id":"27",
"q":"What is restful in rails",
"answer":"Stands for REpresentational State Transfer"
},{"id":"28",
"q":"What is passanger ",
"answer":"Easy and robust deployment of ruby on rails app on appache and ngix webservers passenger is an intermediate to run the ruby language in linux server"
},{"id":"29",
"q":"What is the Difference between Static and Dynamic Scaffolding? ",
"answer":"The Syntax of Static Scaffold is like this:\n\nruby script/generate scaffold User Comment Where Comment is the model and User is your controller, So all n all static scaffold takes\n\n2 parameter i.e your controller name and model name, whereas in dynamic scaffolding you have to define controller and model one by one."
},{"id":"30",
"q":" What is the difference between form_for and form_tag",
"answer":"form_tag and form_for both are used to submit the form and it’s elements.The main difference between these two is the way of managing objects related to that particular model is different.\n\nform_for\n\n——-\n\nWe should use “form_for” tag for a specific model\n\nIt performs the “standard http post” which is having fields related to active record (model) objects\n\nform_tag:\n\n—–\n\nIt creates a form as a normal form. form_tag also performs the “standard http post” without any model backed and has normal fields. This is mainly used when specific data need to be submitted via form.\n\nIt just creates a form tag and it is best used for non-model forms.\n\nExample:\n\n<% form_tag ‘/articles’ do -%>\n\n<%= text_field_tag “article”, “firstname” %>\n\n<% end -%>"
},{"id":"31",
"q":"Explain how Rails implements Ajax? ",
"answer":"Ajax powered web page retrieves the web page from the server which is new or changed unlike other web-page where you have to refresh the page to get the latest information.\n\nRails triggers an Ajax Operation in following ways\n\n\nSome trigger fires: The trigger could be a user clicking on a link or button, the users inducing changes to the data in the field or on a form\n\nWeb client calls the server: A Java-script method, XMLHttpRequest, sends data linked with the trigger to an action handler on the server. The data might be the ID of a checkbox, the whole form or the text in the entry field\n\nServer does process: The server side action handler does something with the data and retrieves an HTML fragment to the web client\n\nClient receives the response: The client side JavaScript, which Rails generates automatically, receives the HTML fragment and uses it to update a particular part of the current"
},{"id":"32",
"q":" Mention how you can create a controller for subject?",
"answer":"To create a controller for subject you can use the following command\n\nC:\ruby\library> ruby script/generate controller subject "
},{"id":"33",
"q":" Mention what is Rails Migration?",
"answer":"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."
},{"id":"34",
"q":" Mention what is the command to create a migration?",
"answer":"To create migration command includes\n\nC:\ruby\application>ruby script/generate migration table_name"
},{"id":"35",
"q":" Explain when self.up and self.down method is used?",
"answer":"When migrating to a new version, self.up method is used while self.down method is used to roll back my changes if needed."
},{"id":"36",
"q":" Mention what is the role of Rails Controller?",
"answer":"The Rails controller is the logical center of the application. It faciliates the interaction between the users, views, and the model. It also performs other activities like\n\nIt is capable of routing external requests to internal actions. It handles URL extremely well\n\nIt regulates helper modules, which extend the capabilities of the view templates without bulking of their code\n\nIt regulates sessions; that gives users the impression of an ongoing interaction with our applications"
},{"id":"37",
"q":" Mention what is the difference between Active support’s “HashWithIndifferent” and Ruby’s “Hash” ?",
"answer":"The Hash class in Ruby’s core library returns value by using a standard “= =” comparison on the keys.\n\nIt means that the value stored for a symbol key cannot be retrieved using the equivalent string.\n\nWhile the HashWithIndifferentAccess treats Symbol keys and String keys as equivalent. "
},{"id":"38",
"q":" Explain what is Cross-Site Request Forgery (CSRF) and how Rails is protected against it?",
"answer":"CSRF is a form of attack where hacker submits a page request on your behalf to a different website, causing damage or revealing your sensitive data. To protect from CSRF attacks, you have to add “protect_from_forgery” to your ApplicationController. This will cause Rails to require a CSRF token to process the request. CSRF token is given as a hidden field in every form created using Rails form builders."
},{"id":"39",
"q":"Explain what is Mixin in Rails? ",
"answer":"Mixin in Ruby offers an alternative to multiple inheritances, using mixin modules can be imported inside other class."
},{"id":"40",
"q":" Explain how you can run Rails application without creating databases?",
"answer":"You can execute your application by uncommenting the line in environment.rb\n\npath=> rootpath conf/environment.rb\n\nconfig.frameworks = [ action_web_service, :action_mailer, :active_record]"
},{"id":"41",
"q":"Explain what is rake in Rails? ",
"answer":"Rake is a Ruby Make; it is a Ruby utility that substitutes the Unix utility ‘make’, and uses a ‘Rakefile’ and ‘.rake files’ to build up a list of tasks. In Rails, Rake is used for normal administration tasks like migrating the database through scripts, loading a schema into the database, etc."
},{"id":"42",
"q":" Explain what is sweeper in Rails? ",
"answer":"Sweepers are responsible for expiring or terminating caches when model object changes."
},{"id":"43",
"q":"Mention the log that has to be seen to report errors in Ruby Rails?·",
"answer":"Rails will report errors from Apache in the log/Apache.log and errors from the Ruby code in log/development.log."
},{"id":"44",
"q":"Mention what is the purpose of RJs in Rails?",
"answer":" RJs is a template that produces JavaScript which is run in an eval block by the browser in response to an AJAX request. It is sometimes used to define the JavaScript, Prototype and helpers provided by Rails."
},{"id":"45",
"q":" What is the difference between include and extend",
"answer":"include makes the module’s methods available to the instance of a class, while extend makes these methods available to the class itself."
},{"id":"46",
"q":"How to call method dynamically",
"answer":"[“foo”, “bar”].each do |method|\n\nMyClass.send(method)\n\nend"
},{"id":"47",
"q":"How to use Nested routes in ROR",
"answer":"The easiest way to create a nested route, is to use the :has_many keyword like that:\n\n# /config/routes.rb\n\nmap.resources :projects, :has_many => :tasks\n\n# and the correspondent task resource\n\nmap.resources :tasks\n\nAdding the second routes, that defines a RESTful route to :tasks, depends if you would like to allow an access to the Task resource,without the project context, this is not a must."
},{"id":"48",
"q":" What things we can define in the model?",
"answer":"There are lot of things you can define in models few are:\n\n1. Validations (like validates_presence_of, numeracility_of, format_of etc.)\n\n2. Relationships(like has_one, has_many, HABTM etc.)\n\n3. Callbacks(like before_save, after_save, before_create etc.)\n\n4. Suppose you installed a plugin say validation_group, So you can also define validation_group settings in your model\n\n5. ROR Queries in Sql"
},
{"id":"49",
"q":"What is asset pipeline",
"answer":"asset pipeline which enables proper organization of CSS and JavaScript "
},{"id":"50",
"q":"What Is Tdd And Bdd? ",
"answer":"TDD stands for Test-Driven-Development and BDD stands for Behavior-Driven-Development."
},{"id":"51",
"q":"What Are The Servers Supported By Ruby On Rails? ",
"answer":"RoR was generally preferred over WEBrick server at the time of writing, but it can also be run by:Lighttpd (pronounced ‘lighty’) is an open-source web server more optimized for speed-critical environments.\n\nAbyss Web Server- is a compact web server available for windows, Mac osX and Linux operating system. Apache and nginx "
},
{"id":"52",
"q":"What is the Default Session state mode?",
"answer":" The default Session state mode is INPROC. "
},
{"id":"53",
"q":"How to set the life time of session variable? ",
"answer":"Using TimeOut property. "
},
{"id":"54",
"q":"Explain about Dig, Float and Max?",
"answer":"Float class is used whenever the function changes constantly.\n\nDig is used whenever you want to represent a float in decimal digits.\n\nMax is used whenever there is a huge need of Float."
},{"id":"55",
"q":"Mention the types of variables available in Ruby Class? ",
"answer":"Types of variables available in Ruby Class are,\n\nLocal Variables\n\nGlobal Variables\n\nClass Variables\n\nInstance Variables"
},{"id":"56",
"q":"Explain how can you declare a block in Ruby?",
"answer":" In Ruby, the code in the block is always enclosed within braces ({}). You can invoke a block by using “yield statement”."
},{"id":"57",
"q":"Explain what is the difference between put and putc statement?",
"answer":"Unlike the puts statement, which outputs the entire string onto the screen. The Putc statement can be used to output one character at a time."
},{"id":"58",
"q":"Mention what is the difference extend and include? ",
"answer":"The “include” makes the module’s methods available to the instance of a class, while “extend” makes these methods available to the class itself."
},{"id":"59",
"q":"Mention what is the difference between a single quote and double quote? ",
"answer":"A single-quoted strings don’t process ASCII escape codes, and they don’t do string interpolation."
},{"id":"60",
"q":"Mention what is the difference between a gem and a plugin in Ruby? ",
"answer":"Gem: A gem is a just ruby code. It is installed on a machine, and it’s available for all ruby applications running on that machine.\n\nPlugin: Plugin is also ruby code, but it is installed in the application folder and only available for that specific application."
},{"id":"61",
"q":"How many types of callbacks available in ROR? ",
"answer":"* (-) save\n\n* (-) valid\n\n* (1) before_validation\n\n* (2) before_validation_on_create\n\n* (-) validate\n\n* (-) validate_on_create\n\n* (3) after_validation\n\n* (4) after_validation_on_create\n\n* (5) before_save\n\n* (6) before_create\n\n* (-) create\n\n* (7) after_create\n\n* (8) after_save"
},
{"id":"62",
"q":" What is bundler? ",
"answer":"Bundler is a new concept introduced in Rails3,which helps to you manage your gems for the application. After specifying gems in your Gemfile, you need to do a bundle install.If the gem is available in the system, bundle will use that else it will pick up from the rubygems.org."
},
{"id":"63",
"q":"What is the Newest approach for find(:all) in Rails 3?",
"answer":"Model.where(:activated => true)"
},
{"id":"64",
"q":"What is eagerloading",
"answer":"One way to improve performance is to reduce the number of database queries through eager loading.You can know where we need eager loading through “Bullet’ Gem"
},
{"id":"65",
"q":" Difference between render and redirect?",
"answer":"Redirect is a method that is used to issue the error message in case the page is not found or it issues a 302 to the browser. Whereas, render is a method used to create the content.\n\n-Redirect is used to tell the browser to issue a new request. Whereas, render only works in case the controller is being set up properly with the variables that needs to be rendered.\n\n-Redirect is used when the user needs to redirect its response to some other page or URL. Whereas, render method renders a page and generate a code of 200.\n\n-Redirect is used as:\n\nredirect_to: controller => ‘users’, :action => ‘new’\n\n-Render is used as:\n\nrender: partial\n\nrender: new -> this will call the template named as new.rhtml without the need of redirecting it to the new action."
},
{"id":"66",
"q":"What is the use of Global Variable in Ruby?",
"answer":"Syntatically, a global variable is a variable whose name begins with $\n\nGlobal variables in Ruby are accessible from anywhere in the Ruby program, regardless of where they are declared.\n\n$welcome = “Welcome to Ruby Essentials”"
},
{"id":"67",
"q":"What is the use of load and require in Ruby?",
"answer":"The require() method is quite similar to load(), but it’s meant for a different purpose.\n\nYou use load() to execute code, and you use require() to import libraries."
},
{"id":"68",
"q":"What is the Notation used for denoting class variables in Ruby?",
"answer":"We can know a variable as “Class variable’s” if its preceeded by @@ symbols."
},
{"id":"69",
"q":"What is the use of Destructive Method?",
"answer":"Distructive methods are used to change the object value permanently by itself using bang (!) operator.\n\n‘sort’ returns a new array and leaves the original unchanged.\n\n‘sort!’ returns the same array with the modification.\n\nThe ‘!’ indicates it’s a destructive method. It will overwrite the current array with the new result and returns it. "
},
{"id":"70",
"q":" What are the engines in mysql.?",
"answer":"In previous versions of MySQL, MyISAM was the default storage engine.\n\nIn our experience, most users never changed the default settings. With MySQL 5.5, InnoDB becomes the default storage engine. "
}
]
}