Skip to main content

ruby on rails interview questions

1. Tell us something about yourself, and how your career growth has been.
2.When did your degree commenced?
3.Tell us something about your work experience.
4.What is the architecture of rails?
5. What can we use ‘runner’ for in Ruby on Rails, and where is it present?
6.What is the structure of Model?
7.What are filters in models and how do we use them?
8.What are callbacks in models?
9.What are helpers?
10.Differentiate between include and join.
11.How would you define validation for a field not present in the table for a model?
12.How can you run validation using a helper defined in the model?
13.What are layouts?
14.What are yields (please define)?
15.Can yields only be used in views?
16.Is yield a helper introduced by rails or is it a ruby feature?
17.Say there are 4 methods in a model: pending, progress, disable and enable. Now, there is a common url for a common controller and action for all four, say ‘default_controller’ and ‘change_status’ with parameter named :status. How will you call corresponding method in model from inside the default_controller?
18.How can you render a collection of objects without using loop statement in ruby?
19.What are the advantages you noticed in Ruby over the programming language(s) you’ve worked in the past?
20.What is the use of methods ‘send’ and ‘send_data’ and how are they different?
21.How well do you rate yourself in Ruby, Rails, AJAX & object-oriented javascript?
22.What are callbacks?
23.Are there any callbacks available for controllers?
24.What are the callbacks available for models?
25.What are polymorphic associations? Give a detailed example of polymorphic association with model associations.
26.What is the use of ‘class_name’ in defining an association?
27.What is the use of ‘through’ while defining associations?
28.How would you link three tables using ActiveRecord and joins?
29.What is the base class for models?
30.What is the use or advantage of alias_method_chain in ruby?
31.How do you validate the uniqueness of an attribute for multiple entries in the table via model?
32.How do you make it unique among different column say ‘user_id’ in the table
33.Does ruby support thread class, and multithreading?
34.What is the difference between *.html.erb and *.erb files?
35.Differentiate between flash and session.
36.Differentiate between symbols and string?
37.Explain method visibilities (public, private, protected).
38.What is ‘method_missing’ used for?
39.Differentiate between session and cookies?
40.Differentiate between has_many and has_and_belongs_to_many
41. Does ruby supports overloading? Give reason to support your answer.
42.How does find_by works?
43.How do dynamic methods get generated when you add attribute names to ‘find_by_*’ ?
44.What is metaprogramming in ruby on rails? Give examples.
45.Differentiate between HTTP and HTTPS.
46.Explain a request cycle in rails.
47.What are ruby blocks? How do they work with yield?
48.What is the difference between Proc and block?
49.Differentiate between attr_accessor, attr_writer & attr_reader, attr_protected.
50.What is cattr_accessor used for?
51.What can we used eval for?
52.Tell us something about the scope of a variable in a class, module, helper and a function in rails.
53.class_instance_variable… what is it?
54.What is the difference and /or similarities between Proc and lambda ?
55.How do you specify extra resource with plugin search?
56.What is activesupport?
57.What is map.resource and how is it different than map.resources?
58.Which version(s) of rails have you worked with?
59.What are sessions?
60.How would you maintain a session in the architecture having a multi-instances application running on same database?
61.What are joins? Explain LEFT OUTER JOIN.
62.How do you use load and require? Differentiate between them.
63.How can you manipulate and resize images in rails?
64.How do you destroy a rails session?
65.Differentiate between class and module.
66.While specifying an around_filter which two methods you must extend, name them?
67.How do we specify inheritance in ruby on rails?
68.Which design pattern does Rails follow and is built upon?
69.How do you specify child resources?
70.Differentiate between - map.resource, map.resources and map.connect?
71.How are session management implemented in rails website?
72.Write ruby code to generate Fibonacci series of given length.
73.Write ruby code for displaying the ‘only’ unique element (one that is occurring only once) in an array of numbers, where others are repeated atleast twice.
74.Tell us something about your current application (xomad).
75.How much do you rate yourself in Ruby and Rails?
76.What is Ruby on Rails, tell briefly?
77.Why did you switch to Ruby on Rails?
78.What are form helpers? How many are there?
79.Differentiate between ‘form_for’ and ‘remote_form_for’
80.What is an index in mysql?
81.What is the difference between prototype and jQuery?
82.What is unobstrusive?
83.What are associations? How many are there?
84.How good are you designing databases?
85.How many types of caching are there in rails?
86.Where are cached files stored in an rails application?
87.If you have used a file management library/plugin, which one(s) you worked with?
88.Where does your application store files data?
89.If you store file data in public directory, how would you avoid accessibility of original files through their complete path in the URL if you’re using paperclip?
90.What is testing in rails? Name and give examples of it’s different types.

Comments

Popular posts from this blog

Get the Current url in ruby on rails

request.refererrequest.fullpathrequest.fullpath.split("?")[0]request.referer or request.env['HTTP_REFERER'] your controller to get the referer url. 

--------------------
request.original_url
request.url
request.host_with_port
<link rel="canonical" href="<%= request.url %>" />
<%=request.path%>
How can I get the current absolute URL in my Ruby on Rails view?
The request.request_uri only returns the relative URL.
request.env['REQUEST_URI']

 For Rails 3.2 or Rails 4 you should use request.original_url to get the current URL. More detail.

For Rails 3: You want "#{request.protocol}#{request.host_with_port}#{request.fullpath}", since request.url is now deprecated.

For Rails 2: You want request.url instead of request.request_uri. This combines the protocol (usually http://) with the host, and request_uri to give you the full address

Gem::LoadError (Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).?

Gem::LoadError (Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).) In rails?


1)change the gemfile in mysql version
 gem 'mysql2'

2)Change to mysql2 version
 gem 'mysql2','0.3.20'

Active Scaffold : Add radio buttons to your form ruby on rails ?

Active Scaffold : Add radio buttons to your form ruby on rails ?

The way to add radio buttons to your active scaffold create/update from is as shown below

#Controller

class UsersController < ApplicationController
active_scaffold :user do |config|
config.label = “Users”
config.columns = [:name, :gender]
config.columns[:gender].form_ui = :radio
config.columns[:gender].options[:options] = [['Male', '1'], ['Female','2']]
end
end