Skip to main content

Posts

Showing posts from March, 2018

Bulk Mailing Using Sidekiq

Introduction: Sometimes the rails application requires sending the bulk mails using action mailers on the single attempt. The user can be able to send them seamlessly. But, this task is not possible in synchronous way. This will affect whole application performance and will take a lot of time to load the respective pages. To overcome this problem rails community have enormous kinds of solutions. Among them  sidekiq is the best choice to overcome this kind of problems. The sidekiq is a full-featured background processing framework for Ruby. It aims to be simple to integrate with any modern Rails application and much higher performance than other existing solutions. The Redisis an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperlog logs and geospatial indexes with radius queries. The Action Mailer

Data scraping in Ruby on Rails using Nokogiri and Mechanize Gem

What is Data scraping? Website/Data  Scraping  is a technique to operating large amounts of  data  from websites whereby the  data  is extracted and displayed in own sites or it can be stored to a File/Database. Data scraping is basically used where the websites does not provides API. Some Applications do not provide API to collect records. For the same , Data Scraping technique is used. The data can be scraped using Nokogiri Gem. The steps are required: Add the gem “gem ‘nokogiri’, ‘~> 1.8’, ‘>= 1.8.1'” . Then run the bundle install Add the “require ‘nokogiri'” , “require ‘open-uri'” line where you will write the code for the scraping. The controller of the page will look like below: The view of the code of view page will look like : The result in our application will look like: Mechanize Gem in rails The Mechanize library is used for automating interaction with websites. Mechanize automatically stores and sends cookies, follo

Ruby on Rails application using Devise

Devise is a flexible authentication solution for Rails. It is a complete MVC solution based on Rails engines. It allows you to have multiple models signed in at the same time. It hashes and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication. STEP 1. gem ‘devise’ install. STEP 2. run bundle install STEP 3. run rails generate devise:install STEP 4. run rails generate devise:views STEP 5. Here in this application we mainly need 2 models, one is member model and the other one is contact model. So now we are going to create our  member model using devise:run rails generate devise member The migration file will located in db/migrate/ devise_create_members.rb. STEP 6. After that you should have to run rake db:create (For creating new database) STEP 7. run rake db:migrate Once you run the db:migrate command, rails will create a ta

DevOps Tutorials for Beginners by Soma Paul

Introduction to DevOps… DevOps is a combination of Development (Software Development) and Operations (Software Productions/IT Operations…) What is DevOps? DevOps is not a technology or tool, it is a concept of behavior, and it is an extension of Agile Methodology. The DevOps is a set of practices designed to overcome the gap between development, QA and Operations by effective communication and collaboration, incorporating continuous integration process with automated deployment. DevOps helps to increase an organization’s speed to deliver applications and services. It allows organizations to serve their customers better and compete more strongly in the market. There are four basic continuous processes in DevOps: Continuous Integration Continuous Delivery Continuous Testing Continuous Monitoring Relationship between Agile and DevOps Agile Development is an umbrella term for several iterative and incremental software development methodologies. The most po

How to combine data from two different tables into new rows to be displayed as one table in Rails application?

Let’s start with an example that you have two different tables called InternalEmail and ExternalEmail. internal_emails Id (integer) sender_id (integer) content (text) Subject (character varying) recipient_email (character varying) Status (character varying) created_at (timestamp without time zone) updated_at (timestamp without time zone) 1 52 internal_content_1 internal_subject_1 44 accepted 2016-10-21 00:49:24.991002 2016-10-21 00:49:24.991002 2 46 internal_content_2 internal_subject_2 43 rejected 2017-10-21 00:49:24.991002 2017-10-21 00:49:24.991002  external_emails Id (integer) sender_id (integer) content (text) Subject (character varying) receiver_id (integer) opened (boolean) created_at (timestamp without time zone) updated_at (timestamp without time zone) 1 44 external_content_1 external_subject_1 42 true 2014-10-21 00:49:24.991002 2014-10-21 00:49:24.991002 2 42 external_content_2 external_subject_2 41 fal