Featured
-
How Regression Testing Detects Integral Errors In Business Processes
Humans are forever changing and evolving and so to
by kristina.rigina -
Get Display Banner Advertising Opportunity on FindNerd Platform
“Do you have a product or service that nee
by manoj.rawat -
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
Top 5 Features That Make Laravel the Best PHP Framework for Development
Laravel is a free open source Web Framework of PHP
by abhishek.tiwari.458 -
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on
by siddharth.sindhi
Tags
Convert rails 3 list of routes to rails 6 list of routes
Having trouble defining multiple routes together in rails 6.
In rails 3 we defined multiple routes like the example below.
member_routes = {
:validate_update_action => :put,
:rebuild_update_form ...
How to isolate cookie store for one subdomain from other subdomains and domain itself in Rails 5?
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.opti...
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...
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 ...
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...
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...
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...
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...
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 ...
Fetching Single objects in Rails Applications
Fetching Single objects in Rails Applications through Active records
While creating a web application in rails we often feel the need to fetch single objects from the database.
Active records provide us with a very good quer...
Sending Email through SMTP mailer in Rails
Sending Email through SMTP mailer in Rails
As we know these days in almost every application we have the need to send mails to its users then be it for password confirmations, subscriptions etc.
So these mails can be sent through your rails...
Using Delayed Jobs in Rails
Using Delayed Jobs in Rails
When creating a web application sometimes need arises that we have to schedule some jobs during the execution of a particular method. Due to these job the render of the page has to wait until the task gets over...
Installing And Using NGROK (Rails)
Installing And Using NGROK for Rails Application
NGROK allows our web application running on localhost web server to be exposed to the internet. Its like making our web application live. It creates a secure tunnel from a public ...
using return keyword within a Ruby block
As we all know,Ruby Blocks and Ruby Methods work in tandem and the output/value of the last line/expression being executed by the block is returned to the associated method .
Have a look at this example:
2.1.5 :006 > def demo
2.1.5 :0...
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...
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...
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 ...
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...
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...
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...
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...
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
...
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...
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...
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...
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 ...
Find out days count in a year
Description:
A variation of determining leap years, assuming only integers are used and years can be negative and positive.
Write a function which will return the days in the year and the year entered in a string. For example, 2000, entered...
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...
Simple way to validate an empty text box on submit
Validating an empty field on submit through JavaScript
As we know in almost all the web applications we have forms which contain text boxes and text fields to input some data and submit it. Sometimes knowingly or unknowingly users can submit t...
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:
...