Featured
-
Installing RVM and Creation of Gemsets Part 2
In the last tutorial we learnt how to install RVM.
by dinesh.singh -
Installing RVM and Creating of Gemsets Part 1
Installing RVM and creating Gemsets can be difficu
by dinesh.singh -
Use pik in Windows
Managing multiple versions of Ruby on Windows can
by anirudh.rautela -
Using Bundler in Rails 2.3.x app
Managing Gems in Rails can be infuriating at times
by anirudh.rautela
Tags
List of Top 10 Ruby on Rails Interview Questions for 2019
Ruby on Rails is a server-side framework written in ruby which provides a default structure for a database, web service and web pages. Ruby on rails uses web standards like JSON for data transfer and user interfacing. Companies including software...
Creating Charts and Graphs in Rails
Creating Charts and Graphs in Rails
Few days back I was working on a project, in which a dashboard was needed with stats showing in different kinds of charts. i.e: pie chart, barchart etc. So I looked for a gem that can include all o...
Migration in Rails - Part2
Hi friends,
In my last blog Migrations in Rails: PART 1 - Introduction and Creating Tables I told you what is migration and how we can create tables in migration today I will tell you some other generic queries that are used:
1. Dropp...
Migrations in Rails: PART 1 - Introduction and Creating Tables
Migrations in rails are basically used for executing DDL (Data Definition Language) statements. The main tasks of migrations are:
1. Creating tables
2. Updating Schemas
3. Altering tables
4. Dropping tables
Each migration works as a new ...
Different Types of Renders in Rails
render is used to provide response of a request in rails. There are multiple kinds of responses that you can send with request. Lets see one by one:
1) actions:
By default if nothing is specified as render, actions are rendered withing in...
Protect From Forgery in rails
The first concern for every application is its security, so rails by default provides a method protect_from_forgery, which is always present by default in your application, whenever you create a new application. i.e.
class ApplicationControl...
Transaction in Rails
As we all know in SQL transaction are used to maintain the integrity of the data, so that if there are multiple queries written, which has a condition that either all of them are executed or none. So for achieving those rails has written the wrap...
Introduction to JWT
With API becoming so popular these days thanks to SPA base applications, it was also required to keep these APIs secure. So the most popular of securing api's is token based authentication, whose flow is little bit like this:
1. In the b...
Changes Related to Active Records While Updating From Rails 3.2 to Rails 4.0
From Rails 3.2 to 4.0, there were so many things that got changed. So here I am telling you the major changes that affected the active records, and that you should take care of during updation from 3.2 to 4.0:
1) There were some inconsistenc...
Integrating SOAP in your Rails Application
Hi Friends,
Most of the large applications use SOAP for data transfer between two parties. So in rails we can also integrate SOAP support. For this there are multiple gems available. One of the mostly used gem is "savon". So here we ...
Integrating SAML with Rails Application: Part 2 ( Setting UP Local IdP server)
In my previous blog Integrating SAML with Rails Application, I told you how we can integrate SAML in your application and also told you few things regarding the Service Provider and Identity Provider. So once you have a ready Identity Provider, e...
Integrating SAML with Rails Application: Part 1
SAML is Security Assertion Mark Up Language, which was built to provide authorization between multiple identities, so that multiple services can use the same authentication.
The SAML authentication can basically happen in two ways:
A) SP In...
Things to Notice Before Upgrading Rails Application
Hi Friends,
Whenever you create an application it is never for lifetime, there is always something and better comes in the market, and once we talk about rails application, it comes pretty quickly. After every few months rails comes with a new...
Changes regarding HTTP PATCH in Rails 4
Hi Friends,
There were so many changes came with introduction of Rails. So one the major change was regarding the HTTP Patch Requests. From rails 4, whenever a resource is declared in the routes, by default it uses PATCH as primary verb...
Stashing in Git
Hi Friends,
Git is the great tool for project versioning and code management, but mostly we are unaware so many things. So here I am going to tell you what is stashing in Git.
Sometimes we are working on some code and we don't want it t...
Upgrading Rails Application From 3.1 to 3.2
In my previous blog Upgrading Rails from 3.0 to 3.1, I explained you how we can upgrade a rails application from 3.0 to 3.1. In this I am going to show you, what changes are required to update an application from 3.1 to the latest of 3.2 rails ve...
Upgrading Rails Application From 3.0 to 3.1
Upgrading a rails application directly from a lower version to a much higher version is never a good idea, so the best idea is to do it step by step. like one upgradation at a time. In my previous blog Things to Notice Before Upgrading Rails Ap...
Ruby Enumerables: (all, any, none, find)
Ruby provides a number of enumerable methods that we can pass on collections or array for performing searching, sorting etc operations.
Here I will be discussing with all, any, none and find methods:
a) all?
In this every member of the...
Different Equality Operators in Rails
1) ==
It is a simple equality operator, that only checks if the value of the left operand is equal to the right operand or not, so returns true or false respectively
<pre>
> x = 5
> y = 5
> x == y
=> true
> y =...
Achieving Nested Comments in Rails
Few days back, I was working on a project where I have to create nested comments on a articles and on showing the article I was needed to show all the nested comments in its hierarchy.So I used closure_tree gem to achieve that. So lets see how I ...
Differences between Require, Load, Include and Extend methods in ROR
Include: If your application has many classes that need the same code, then we can keep that reusable code in a module and include that module in class.
When we Include a module into a class, it is like we are taking all the methods within the m...
Rails 4 Strong parameter
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 r...
Full text search in rails with pg_search
We often need to integrate search functionality in our application, If our rails application is using PostgreSQL as a database, then we can use pg_search gem. This is the easiest way to add a search feature on any rails application having postgre...
Responses In Rails: Part 1
Hi Friends,
As we all know rails works on MVC Architecture, where the controllers acts as the receiver of the requests and sends the response back to the requester. There are actually 3 ways a controller can send a response :
a) render: It ...
Rails Browsernizer gem
Sometimes it happens that our application doesn't support a browser with an older version, in that case, we wish to restrict a user from running our application on an older version. In rails, we have a solution to for this problem.
Browserni...
Implementing Token Based Authentication in Rails
In modern world, most of the web applications are api based. So using api's we also need to validate the authenticity of the user. When it is a proper web application the authentication of the user is maintained using cookies and sessions. Bu...
Inspect, to_s, p and puts in ruby
In rails, sometimes we don't notice it but there is difference when you use puts to print an object and when you use just p to print an object. One thing let me clear for you, p is not a short form of puts, they both are different.&...
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...
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...
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...
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:...
Page caching in Rails
Page caching is a technique in which the output of an action is stored as a HTML file and when a request comes for that action,the web server can serve it without going through Action Pack. So basically in this approach we cache the content...
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...
Rails Testing with Cucumber
Rails Testing with Cucumber
Hi Friends,
In my previous blog Testing In Rails: Introduction and Creating Test Data, I had given you a brief idea about testing and later we talked about how we can test rails models and controllers. Here ...
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...
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 ...
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 ...
Creating PDF from HTML in rails
Creating PDF from HTML in rails
Hi friends,
In rails if you want to generate a pdf, there are multiple gems available that will make your task easy. Normally the approach for creating a pdf will be first create a html template and then conver...
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...
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 ...
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...
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 ...
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 ...