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
Ruby on Rails: Top 9 Reasons to Adopt It for Your Next Web Development Project
With several programming languages currently available in the market, it’s very easy to get confused when it comes to choosing the path that suits your goals. Choosing a technology that you’ll use to develop a web app is one challenge...
5 Benefits of ROR Framework That Make it the Ideal Choice for Web Development
Released over 13 years ago in 2005, Ruby on Rails (ROR) has proved to be nothing less than a phenomenon in the world of web development. Its use of concepts like don’t repeat yourself (DRY) and convention over configuration (CoC) have strea...
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...
Using GREP in Ruby
Working with GREP in Ruby
As we know that ruby contains a lot of built in modules, in which one of this is the Enumerable module. So before preceddingon what GREP is and How it works, first lets study a little info about Enumerable module...
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...
Making Thumbnail Image in CarrierWave
As we know that in almost all web applications we use images then be it larger images or thumbnails
So for these functionalities we use Carrierwave gem. This gem helps us with uploading images and files.
With the help of carrier wave ...
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 =...
Asset Package Pipeline In Rails
The asset pipeline can be said as a tool through which we allow the Javascript files, stylesheets, and images to be prepared so that they can be used by the browser.
These processes are used to compress all the coffee script and...
Creating a random string for multi purposes in Rails
As we know that in almost all web applications we have to ammend functionalities in which we need to create a random string.
This string can contain some alpha numeric characters, numbers, lower case alphabets, upper case alphabets and etc.
...
Reading text from a file and saving in the database in Ruby
As we know that in almost all web applications we need to amend such a functionality where you need to get the content from a file stored externally in your pc. lets say this content to be a simple text content.
In these cases what we can do i...
before_save And after_destroy callbacks in Rails
Sometimes while developing applications, need arises that we have to get some operation performed either before or after the execution of some method.
For these purposes rails provide us with some nice hooks or we can say callbacks which can b...
Tap in Ruby
In Ruby, we often sum up our code in the minimum number of lines. We have a method tap which helps us to perform number of operations, which are dependent on the intermediate results.
for example.
(1..10).tap{|x|}.to_a
=> [1, 2, 3, 4...
Use of lambda, Proc and Block in Ruby
Today we are going to see the basic differences between Block, Procs and Lambda.
All these three are commonly used as inputs to some iterators like each and map.
Blocks
Blocks can't be stored ...
Arrays and Hash In Ruby
Ruby's arrays and hashes collections having indexes. They can also be said as indexed collections.
Arrays and hashes store collections of objects which can be accessed using a key.
Both arrays and hashes grow as needed to hold...
Using Dependent Destroy 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 h...
Ruby Access Control
The Access Controls provide us the method which allows us to set access to classes , methods and other members in Ruby. They help us to bind the components to maintain the security of the methods throughout the project.
Rub...
Namespaces And Scopes in Rails
As we know that in rails, in order to reach to any page or URL we have to create routes and resources for the same.
Namespaces and scopes are wrappers which can hold our resources inside them and create the routes accordingly.
Namespaces...
find_each method with options in Rails Active Records
When creating web applications, always a need arises when we have to iterate over a large number of records.
This process is called retrieving multiple objects in batches. This can be done through find_each method.
The find_each method by d...
Using scaffold along with Active Admin
If we are incorporating Active Admin,a gem that provides a full-fledged admin panel,with our rails application,then a common anomaly encountered is ,scaffold command won't be giving out desired results.
The basic feature of scaffold is to ...
Active Records for Adding, Removing or Changing a column
When we create a web application we generally create models which are referred to as tables in the database. Sometimes we need to add a column to the existing table or remove an unused column from the table or just change the column. The way to d...
How to add a default value in a column through Migration in rails?
As we know that the rails migration is used to interact with the database and create schemas.
Many a time when we are creating migrations, we may forget to add a column in the table.
Or sometimes a need may arise when we have to make ...
Ruby Enumerators
Enumerator is a type of class which allows both the internal and external iteration.
List Of Enumerable Methods in Ruby:
collect
map
each
select
Collect:
It is similar to the map method and it allo...
JQuery Slider for Rails
JQuery Slider as Substitute for Bootstrap Carousel for Rails
Hello readers,
We all may have integrated Bootstrap Carousel with templates in order to make images sliding one after the another, giving our template a lively look.
JQuery sli...
How to use partials in Rails Applications
As we know that in almost all web applications there is a set of code which has to be executed often in many places.
Now suppose we have a header and footer which has to be used all over the project.
Now if we would write th...
before_validation and and after_touch callbacks in rails
Rails provide us with some pre-defined methods or hooks which can be invoked after or before the execution of a certain method in the object life cycle.
Callbacks are called in certain moments of object's life cycle which we will get to kn...
Discussion on collect/map function in Ruby
Welcome to Findnerd. Today we are going to discuss callback or map function in Ruby. If we talk about the callback function then it is used for arrays, hashes as well as ranges. map as well callback is used for same purposes so you can use either...
after_initialize and after_find Callbacks in Rails
At the time of normal operations in rails application, the objects are either updated, created or destroyed or we create our defined methods in the controller.
Rails provide us with some hooks in the object life cycle which we can invoke...
Importance of Modules
Module is one of the most important tool in the Ruby toolbox. They are generally used to namespace ruby classes.
module Test
class Hello
end
end
The class Hello will be wrapped in the Test namespace which means that if we want to c...
Cross-Site Request Forgery in Rails
What is CSRF in rails?
CSRF means Cross-Site Request Forgery. It is an attack where an attacker will submit a form on our behalf to a different website , causing damage to the website or revealing the sensitive information from the w...
Eager Loading and Lazy Loading in Rails
Eager Loading and Lazy Loading in Rails
As we know that almost every web application has an interaction with the database to fetch records or insert records and other functions.
This can be achieved through different types o...
Redirect_to and Render methods in Rails
As we know that in rails we have models view and their controllers which act as a medium between model and view.
The normal flow between a controller and a view is to display a view corresponding to its controller action.
So this can ...
Discussion on merge function in Ruby
Welcome to Findnerd. Today we are going to discuss merge function in Ruby. If we talk about the merge function then it is used for hashes only. We can merge two hashes in one hash. Please have a look.
teacher1 = { "id" => 232 ,"...
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 ...
Discussion on find functions in Ruby
Welcome to Findnerd. Today we are going to discuss find functions in Ruby. There are different functions available. Please have a look.
A) find/detect : It will return either object or nil.
(0..10).find { |i| i == 5 }
...