Skip to main content

Posts

Virtual Studio Code for Ruby on Rails Development

Introduction to Vscode (Visual Studio Code) Visual Studio Code i.e. Vscode is a modern and robust code editor developed by Microsoft. We can use it for setting up Ruby on Rails development environment. It combines the simplicity of code editor with powerful tools like IntelliSense, code completion, debugging and built-in Git support. One of the beauties of Vscode it's free and open source. It is available for Windows, Mac, and Linux with huge community support.  How to Install Vscode? Installation steps of Vscode are pretty simple, go to  Visual Studio  it will automatically detect the operating system you are using and provides a download link. After installation, you are ready to start customizing Vscode for Rails development. How do you set up Vscode for Rails? ·  Ruby extension: The first thing you have to install the ruby extension in Vscode. Press  f1 , type  ext install  then search for ruby OR go to ‘View’ > ‘Extensions’ and search for ruby and
Recent posts

All New Features Introduced in HTML 5 and CSS 3

As a web developer, everyone knows the importance of HTML & CSS for making his or her web pages to be interesting. We all know that web languages upgrade regularly, so all web developers need to stay current and updated. The latest version of HTML has introduced in the market i.e. HTML5. HTML5 has all new features that you will love to use while making document structure. A bunch of new tags to make our pages more semantic has introduced in this version. It will also help search engines and targeted audience to navigate our pages and improve the web experience for everyone. Some of the new semantics or structural elements have been covered here: Tags Description <article>   Defines an article in a document <aside>   Defines content aside from the page content <figure>   Defines self-contained content <mark>   Defines marked/highlighted text <progress>   Represents the progress of a task <section>   Defines a section in a document
Being a Rails developer we are familiar with ActiveRecord queries, but not so much with Arel. Arel is a library which allows us to customize our queries in an object-oriented manner without having to use manual SQL and string interpolation. We often use where a method for querying the database. Where method can handle equality, null, arrays and now in Rails 4 it is also able to handle inequality condition with not method. But when there is a requirement of writing queries with OR statement or greater-than or less-than conditions most developers opt for writing SQL string queries. We have a better way to handle this situation using Arel. For example: If you want to select students having the date of birth greater than today’s date or date of birth less-than or equals to today’s date, usually a developer will write the query like this Student.where("date_of_birth> ?", Date.today) or Student.where("date_of_birth<= ?", Date.today) But this is not a go

How to Track Page Impressions in Ruby on Rails?

Many times, we need to track the page views of any page such as profile page, shopping sites page in a Ruby on Rails applications, for which we can make use of Impressionist gem to track those page details easily. It is a lightweight plugin that logs impressions per action or manually per model. We can log impressions multiple times per request. And we can also attach it to a model. Below are the simple steps needed to follow to implement it: Step 1: Create a sample app using scaffold. Step 2: Add “gem ‘impressionist’” gem to the Gemfile and install it by running bundle install command. gem ‘impressionist’, git: ‘https://github.com/jordanhudgens/impressionist’ Step 3: Nowgenerate the impressions table migration by running the below commands: rails g impressionist rake db:migrate Step 4: Now we need to update our controller that we want to add the impression or page views counting system. So first we have add the following method in our controller with men

AngularJS Web Application Automation with Protractor Tool

The dynamics of web development have changed over the years. The HTML single page coding with CSS styling is an obsolete method now. One of the open source front end web application framework is the JavaScript based AngularJS, which has been in the industry for around 6 years now. What reason do we need Protractor Framework for? Protractor is a node.js program that is used to write end-to-end test. The tests are written in javascript to simulate user stories on a web browser. Protractor is effectively built upon webdriver so a lot of stuff we do on protractor will seem very similar. JavaScript is utilized as a part of all web applications. As the applications develop, JavaScript additionally increments in size and many-sided quality. In such case, it turns into a troublesome situation for Testers to test the web application for different situations. In some cases, it is hard to catch the web components in AngularJS applications utilizing JUnit or Selenium WebDriver.

GraphQL With Ruby

Now a day’s most of the web or mobile applications fetch data from server which is stored in a database. REST API provides an interface to stored data that require by the applications. GraphQL is a query language for REST API's not for server databases. It is database agnostic and effectively can be used in any context where an API is used. GraphQL provide platform for declarative data fetching where client need to specify what data needs from API in response. Instead of multiple endpoints that return fixed data structures, a GraphQL server only exposes a single endpoint and responds with precisely the data a client asked for. GraphQL minimizes the amount of data that needs to be transferred over the network and improves applications operating under these conditions. Introduction to GraphQL API on Ruby on Rails Start with adding gem in Gemfile gem ‘graphql’ Run command bundle install Run command rails generate graphql:install Above command will add gr

How to send email without using any server side language with the help of node.js?

What is node.js? Node.js is a server-side platform built-in JavaScript framework The steps to be followed : Step 1: Install node.js Step 2: Install npm (node package manager) Step 3: Install node mailer by running :   “ npm install nodemailer “ Step 4: Create a file called “package.json” in your project folder and write the following code : Step 5: Run “ npm install “ Step 6: Create a “Server.js” Step 7: Create a form on index.html page Step 8: Write js code form Submit button, this code will check the validation before sending mail. Include this file on index.html by using : “  http://js/node-mailer-contact.js   “ index.html form (view) : Step 9 : Create a method for SMTP ( Simple Mail Transfer Protocol ) in “Service.js” file through which email will be send: Step 10: Create a method for sending email in “Server.js” file: Step 11: Start the node js server on the terminal by running : “ node Server.js “ It will look like : After filling the for