
Search In
Modules are similar to classes basically every class object is ancestrally a module object.When you create a class you can create instance of that class through which you can execute class's method but this is not possible in modules as it doesn&
These are few methods which have slight difference.
Lets discuss it one by one :
Shift() :
This method is similar to pop() method, the only difference is that it works at the beginning of the array. It delete the first element from the given array
Ruby: Meta Programming: Method that makes Methods
Hi friends,
The normal way of defining method is to give the method name after def and write code between def .... end, and it is pretty fine for most of the cases, but sometimes suppose we need som
Rails 4 has many new features, and Strong parameter is one of them. Strong parameter allows us to choose attributes that can be whitelisted for mass assignment. In rails 3 we were doing this by listing accessible attributes in the model. But in rails
As we know that all the models in our rails application are connected to one another through relations between them.
Now these relations can be one to one, many to many, many to one or one to many and etc.
Now lets see a scenario where we have an a
Basically slice() method is used to extract some particular elements from an original array (suppose i need to show only selected elements from original array). It contain two parameter start/begin and end.
begin ->It is the position where to sta
Linear search is simple search algorithm in which a sequential searching is done over all the items in a list. Every items are checked and if any match is found then that item is returned otherwise search will be continuued till the end of the dat
Hello,
I need to have cookie store #1 on a.example.com
and I need to have cookie store #2 on b.example.com and on example.com
One method was to change cookie name per subdomain / domain, however
request.env['rack.session.options'][:key] =
Rails Migrations can be used to alter the database.Migration allows ruby to define the changes in database schema in a consistent and easy way.
So If one deleloper make some changes in database schema, the other developers just need to update, and ru
Overriding Equality of objects
In ruby the equality of the objects depend upon several things, which are
a) ==
b) hash
c) eql?
In normal cases whenever you run == method for string numbers etc it works perfectly fine, but if there are two identic
