What is Binstub?

While I was installing RSpec I run a command here

$bundle binstub rspec-core

I was wondering, what exactly the binstub is?
And why we have to use it?


Binstub is the Binaries require by the executable files. Basically, Binstub prepare the environment around executables before dispatching the call. Ruby might need an extra stuff to their job and here the binstub is use to make sure that the stage is properly set.

let’s go through an example from the Guide

#!/usr/bin/env ruby
require ‘rubygems’

# Prepares the $LOAD_PATH by adding to it lib directories of the gem and
# its dependencies:
gem ‘rspec-core’

# Loads the original executable
load Gem.bin_path(‘rspec-core’, ‘rspec’)

The purpose of every RubyGems binstub is to use RubyGems to prepare the $LOAD_PATH before calling the original executable.


Rack offline

Let’s do some interesting stuff. Today we are going to offline the single page of a web application. For this, we will use Rack offline in Ruby on Rails version 4.


Installation and configuration

To install write

$gem install ‘rack-offline’

then open Gemfile and add

gem ‘rack-offline’


after that open config/routes.rb file and add

match “/application.manifest”=>Rails::Offline,:via=>[:get], :as=> :manifest

then open view/layouts/aaplication.html.erb

<html lang=’en’ manifest=’/fr/application.manifest’>

and then Run the server using

$rails server

and here’s you are done. 🙂 your web page will work offline.

July 14: Magic is here!

Today i woke up early in the morning at 0730. Earlier past days i was suffering from fever but today i feel fresh and at 0800 i started working on rails from agile web development with ruby and rails 4
I read about ORM(Object relational mapping) layers in rails
ORM layer maps tables to classes, rows to object, columns to attributes of the class. Class method are used to prerform table level operation and instance method perform operation on individual row.

Then I read about Ruby names. I am sharing few with you.
Method names- lower case letter with an underscore
Instance variable-@
Class name- use capital letter ex- PurchaseOrder

Redrict_to :action=>”edit”, :id => params[:id]
:action-> thing named action

Then I read about how to create an array in Ruby. Let me share a shortcut with you :p
Shortcut to create an array of words
A=[‘ants’, ‘bee’ , ‘cat’]
#this is the same
A=%w {ant bee cast}

Then By all this my part one of the book is over now its time for the Part 2
In part 2, In this part I am creating a shopping website which has two user roles a buyer and a seller and in this i studied a magical command. As magician never reveled their trick :p same way you just need to use this command
And you will see the magic
Now i am creating a UI for a product details which we store in database and their attributes are
Product description
Image URL
Now the magic is going to happen

$rails generate scaffold product title:string description:text image_url:string price:decimal

Product is the name of table
Now this will create a whole UI to add new item
Modify it
Delete it
Everything is done with this single command
U have to do nothing its like you got everything in a plate now u just have to eat it. Its just a Idiom :p
Its just a trailer for more details must read Agile ruby on rails 4
Seriously Ruby on Rails are very much interesting keep in touch with me to know more magic tricks.
Good nite 🙂