Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Implicit and Explicit Blocks in Ruby

Blocks are basically a group of code that can be stored in a parameter and can be executed. There are majorly two ways of doing this:   1) Implicit: In implicit, it is a nameless block and it is not passed as a parameter, it is exec...

Use of Super Keyword and Mixins In Ruby

Use of Super Keyword and Mixins In Ruby Super Keyword Ruby gives us with a built-in function called super that allows us to call methods which are present in its super class.  The use of inheritance is to make the overridden methods...

Overriding Equality of objects

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 ar...

Method Overloading and Overriding In Ruby

Method Overloading Method overloading can be achieved by declaring two methods with the same name and different signatures. These different signatures can be either   1.Arguments with different data types, eg: method(int a, int b) vs m...

Sum without highest and lowest number in an array

Description: Sum all the numbers of the array except the highest and the lowest element. Example: { 6, 2, 1, 8, 10 } => 16 If array is empty or null, or if only 1 Element exists, return 0.   Test Cases: Test.describe("...

Ruby Blocks

As we all know,Ruby Blocks and Ruby Methods work in tandem as clearly elucidated by the below example: def demo_method yield "hello" end demo_method { |block_argument| "#{block_argument}!! our first ruby blog"}   here, the ...

Few Important Hash Methods in Ruby

Hash: Hashes are way of storing data in key-value pair format. Key can be any ruby object ( i.e. string, numbers ). Here we will see some of mostly used methods for hashes. 1) Creating/Initializing a hash: Hash can be created i...

Join and Inject methods for arrays (Ruby)

Join and Inject methods for arrays in ruby Join method is used to combine all array elements into one string. With the help of join method we can combine a lot of strings present in an array into one single string. Join method can a...

Array operations in ruby

In our regular programming life, we always come in to situation where we need to pick few elements from array, remove them or insert some elements into them. In ruby there are methods available for such operations. Some of them are: 1) Select:...

find_all method in ruby.

The find_all method has to do with arrays in Ruby.This method simply iterates through all the elements in an array and meanwhile test each of them against a test condition and finally returns an array containing all elements for which the test re...

Integrating Paypal in Rails Application (Part-2)

Paypal Integration in Rails (continued) Now, When the user is redirected to the method paypal_url , defined in the model file (order.rb) there we will give the html variables in which we will connect our application to the pa...

Integrating Paypal In Rails Application (Part-1)

Paypal Integration in Rails As we know that these days many web applications have the functionality and requirements of money transactions. For example today we will take an example, of an e-commerce website or we can say an online shopping we...

Integrating Backbone JS with Rails Application

Integrating Backbone JS with Rails Application It is an era of Single Page Applications. So there are multiple javascripts framework available that supports SPA. Two most popular frameworks are: Backbone JS Angular JS In this section we w...

Sessions, Cookies and Flash in Rails

Sessions, Cookies and Flash in Rails In rails if we want to store data for multiple request there are majorly three kinds of mechanism can be used for different different purposes.  Flash: Flash stores the data only until the new re...

Exception Handling in Rails using begin rescue

Exception Handling in Rails using begin rescue Exception is a condition, that occurs when something goes wrong in a code. Normally in that case the program gets terminated. In rails, an object containing the information of the error is an inst...

Ranges in Ruby

In modern programming world, ruby is so much popular because of its easability and general purpose syntaxes. Ranges are yet another example of that feature. They store the start and end of a sequence and rest are assumed to be inside them. Ranges...

Testing In Rails: Functional Testing For Controllers

Testing In Rails: Functional Testing For Controllers   Hi Guys, In my previous two blogs Testing In Rails: Introduction and Creating Test Data and Testing In Rails: Unit Testing In Models, I talked about the introduction and usage of ...

Testing In Rails: Unit Testing In Models

Testing In Rails: Unit Testing In Models Hi friends, In my previous blog, Testing In Rails: Introduction and Creating Test Data, I had given you a brief introduction of rails test cases and why they are required. Also I guided you how we can ...

Testing In Rails: Introduction and Creating Test Data

Testing In Rails: Introduction and Creating Test Data   Hi friends, Even if you write code considering every case in mind there is always a chance that your code contains bugs. So the best way of writing a code that contains least num...

Error- 443: Network is unreachable while installing RVM

If you are setting up RoR on a system, and while installing RVM you get an error like curl: (7) Failed to connect to get.rvm.io port 443: Network is unreachable this is due to mis-configured ipv4 & ipv6.   As you already kn...

Dealing with Files in Ruby

In my previous blog Dealing with Directories in Ruby, I explained you, how we can play with directories in ruby. Today I am going to tell you how we can interact with files by opening them in different modes and performing read/write operations i...

Fake S3 Server For Local Development in Rails

Fake S3 Server For Local Development in Rails Hi Friends, Once I was developing an application that includes accessing and saving the data to S3 buckets. But I didn't have any S3 account at that time, So I searched for a thing that can si...

Dealing with Directories in Ruby

Ruby is a rich technology and its integration with system commands makes it much more richer. In Ruby if you want to create, read, delete or change the directory, there is Dir class available for that, which provides multiple methods for dealing ...

How to install and use Active Admin as your Admin Panel for Rails Application?

As we know that these days every web application needs an admin panel which allows the owner or the manager of the web application to manage all the data and restrict the accessibility of certain things to certain users. For that there is a ge...

Importing and Exporting Records in CSV format in Rails

CSV files are comma separated values file that stores the data values in tabular format, where each column values are separated by commas. They are the lightest way of storing data in tabular format that is why most of the bulk data are exported ...

Kaminari Gem

Hi Friends, Pagination helps us distributing a large amount of data in batches and show them in the views. In rails there are so many gems available for pagination like will paginate, kaminari. Today I am going to tell you how we can integrate K...

Some Server Side Validations in Rails (Active Records)

Hello Everyone, As we know that in almost all web applications there are certain things which need validations to be performed on them. Validations can be performed in two ways that is client side and server side. Client side validations...

How to install Rails admin in Rails application

How to install Rails admin in Rails application As we know that almost all web applications have an admin panel through which the administrator of the application  can manage all the data of the application and make necessary chan...

Redirect Back To Same URL after Login through Devise in Rails

In almost every web application there are certain things which a user is allowed to do only after he or she is logged  in into the website. If user  trying to access some page or some URL where he/she can get access only after logging i...

Integrating Comparable charts in Rails Application

The best way of representing a data set for analysis is using charts. So if you are developing a rails application and you want to show the analytics as charts in the dashboard, there are multiple gems available in the rubygems community. Here I ...

Calculations in Active Records Query Interface

Active records query interface provide us with some very nice features to perform calculations or mathematical operations to retrieve selected records on the basis of those mathematical calculations. Those methods are as follows: Count ...

Rails Active Record Callbacks: Part 3: [after_find after_initialize and conditional]

Hi friends, In my previous two blogs Rails Active Records Callbacks: Part 1 and Rails Active Records Callbacks: Part 2, I explained about available rails active records callbacks available. Now I will talk about some more callbacks method...

Hash Conditions in Active Records (Rails)

Hash Conditions in Active Records (Rails) Active records allows us to to pass in array conditions to our query to fetch a single record or all the records matching  the key value pair. In these hash conditions we pass the key as the na...

Some Common Validation in Active Records (Rails)

Hello everyone, As we know in almost all the web applications there are forms, text boxes and several other fields which need big time validations so that the security of the application is maintained and no one should be able to alter it or p...

Integrating ckeditor in Rails

Hi friends, Today I am going to talk about how to integrate ckeditor (a text editor) in your rails application.  Ckeditor is the most commonly used text editor now a days, because of that there are so many gems  available. Here I am ...

Simple Search Functionality In Rails

Integrating Simple Search Functionality In Rails As we know that in almost all the web applications there is a search functionality. This functionality includes a search bar or search text box in which we can write the thing which we want to s...

Solution to the problem when scaffold inherits the inherited class due to active admin

Solution to the problem when scaffold inherits the inherited class and not the application controller due to active admin   While creating a web application in rails we always need an admin panel through which we can manage t...

Rails Active Records Callbacks: Part 2

Hi Friends, In my previous blog Rails Active Records Callbacks: Part 1, I explained about why these callbacks are required and also discussed about some of the useful methods available in rails active records during creation and saving of the ...

Array Conditions and selecting specific fields to find or retrieve from database (Active records)

Array Conditions and selecting specific fields to find or retrieve from database through Active records Array Conditions To retrieve some specific data from the database we use the where method which gets the records in the form o...

Rails Active Records Callbacks: Part 1

Hi friends, Whenever you create,save or initialize an object there are so many things available in rails that are called Callbacks or Hooks. They can be used as checks between on stage of the object to another. In this chapter I am going to ex...

Customizing Routes with resources

Hi Friends, In my previous blog Routes in Rails using Objects, I explained about using routes with objects. Today I am going to tell you about how we can customize the routes that are created using resources. As we know whenever we mention res...

Adding, Removing or Changing a column through Active Records in Rails

While creating a web application we create models in our application which act as tables in the database. Sometimes when the development of the application moves further, the need arises to add a column to our existing table or removing a column ...

Routes in Rails using Objects

Hi friends, Whenever a request comes to a server, the first thing comes into picture is routes, that tells the request about which controller's action will respond to that request. When I started creating my first application one thing alw...

Listing, Managing and Using Ruby versions

Listing, Managing and Using Ruby versions in Rails application I am writing this blog to discuss how can we see ruby versions installed in our system. In addition to it this blog also contains how can we manage them and use different v...

Compare similar words in two strings

DESCRIPTION: Two Samurai Generals are discussing dinner plans after a battle, but they don’t appear to reach a consensus.   The discussion gets heated and you cannot risk favoring either of them as this might damage your political...

Count the occurence of an interger in a string

Description: Given a string of integers, count how many times that integer repeats itself, then return a string showing the count and the integer. Example: countMe('1123') (count_me in Ruby) Here 1 comes twice so <count>...

Handling Invalid JSON errors in rails

Handling Invalid JSON Error in Rails  Hi Friends, Sometimes by mistake, when we send an incorrect JSON to server, the server is not able of handle the improper JSON so it throws an error, and the client doesn't get any proper error m...

Ruby on Rails Command Line: Part 2

Hi Friends, In my previous blog Rails Command Line Tools. I discussed about some rails command line tools. Today I am going to tell you about rake command in rails. rake is actually a ruby version of unix's make command. It is also used to...

Rails Command Line Tools

Rails is a language particularly known for its rapid development and shortcut commands that make development of applications and its modules fast and easy. Today I am going to tell you about few most basic commands of rails: 1. rails new: ...

Adding social icons in your site

Hi friends, You might have seen several icons of social networks in many of the sites. If you want to add this in  your rails site, there is already a beautiful gem called social-share-button. I am explaining here how you can integrate it s...
prev 1 2 6
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: