Posts tagged with : rails

Associate with ActiveResourceAssociatable


A communication of a web app with others is not a surprise, but it is the demand of mobile world's era. Because new apps want to maintain a centralized DB which could be shared with other apps very easily and very frequently. Recently, I also worked on a similar distributed web app which provided me an idea to implement a rubygem.

ActiveResource is a ruby library which acts same as ActiveRecord, but perform operations over API. ActiveResourceAssociatable is also a ruby library which consolidates same kind of associations methods as ActiveRecord provides. However it could be achieved by own customized methods, but ActiveResourceAssociatable provides smarter way of accessing your ActiveRecord and ActiveResource methods. ActiveResourceAssociatable comes with some options too which will make you more easy to use this gem.

ActiveResourceAssociatable

More...


Roda versus Rails


Few days back, I heard about Roda which could suppose to be a replacement of Rails. Roda is a routing tree web toolkit, designed for building fast and maintainable web applications in ruby. The creator of Roda is Jeremy Evans. Rails is dead we hear it every years and it is more widespread after twitter's jump from Rails to Scala.

According to Jeremy Evans, Roda provides Simplicity, Reliability, Extensibility and Performance. Roda has low per-request overhead, and the use of a routing tree and intelligent caching of internal datastructures makes it significantly faster than popular ruby web frameworks. But as per my opinion, Rails is good and getting more mature, stable and popularity every year. Here I will compare these two over some points.

Prerequisites

More...


Is ActiveSupport::Concern really Another Concern?


In Ruby world, Rails is a well known web-framework and ActiveSupport is an integrated component. ActiveSupport is a ruby gem which comes with rails by default. But, we can also use this library or gem separately. ActiveSupport is very easy to understand upto the extend that if you are planning to read the source code of rails, then start with ActiveSupport. So, today I am going to throw some light on ActiveSupport::Concern which is also one of the component of ActiveSupport. Is ActiveSupport::Concern really Another Concern?

This post is for those who are new to ActiveSupport. Who constantly do utility work like encoding, or decoding JSON, generating random number, number to currency conversion etc. But never got the chance to find out the reason behind this. Have you ever looked into the source code of any rubygem where you found the statement like extend ActiveSupport::Concern. If yes, are you familiar with this statement? Why do we use this? Trust me ActiveSupport::Concern is not a concern, but to make your life easy.

ActiveSupport::Concern is useful in mixin or modules. It is more useful whenever you are building your own rubygem.

Without ActiveSupport::Concern

More...


How To Wire up Ruby on Rails and Ampersand.js As a Single Page Application


Ampersand.js is a latest web framework like any other javascript framework e.g. Angularjs. By definition,

Ampersand.js - A highly modular, loosely coupled, non-frameworky framework for building advanced JavaScript apps.

This definition is correct. Ampersandjs is really a non-frameworky framework. Now question comes, Why Ampersand.js?. Because we love Backbone.js, and Ampersand.js is written on the top of Backbone.js. For more details, please refer http://ampersandjs.com.

In this article, I am explaining you to build a simple single page application (not simple as much as any hello world or todo app :)) using rails and ampersand.js. The application will be wired-up with a Rails application and will fetch all its data from rails generated APIs. In fact, behind the scene, Rails application is providing the APIs directly from the file app/assets/javascripts/ampersandtest/data.json. You can also fetch the data from any other application too using your web-service call. The source code is residing on my github repository Source Code and demo is available on Demo. Let's start from scratch.

Basic Installation

More...


Smart Deployment using Hubot


Github is an invariably well-known name in the world of open source. Githut consistently provides a propitious and favorable platforms for any betterment, reform or innovation in the technology which could also discern as an your open source contribution. Hubot is also one of such examples which posses the sovereign potential to metamorphose the process of deployment of rails apps. I came across the term hubot last year and I also heard that numerous enter-prize level organizations benefiting their processes by hubot. My curiosity enabled me up-to the extent that now I am writing a blog :).

Hubot describes its work as an amazing campfire bot who plays the vital role of an user, deployed on heroku, and will add into your campfire chat room as a normal user through heroku URL. However, the heroku app will be revealing as an error page which could cause a confusion in your mind about credibility of the chat bot.

First of all, deploy a dummy app on heroku which could be initiated using this command.

gem install heroku

I am assuming here that you are familiar some what with heroku and have created your profile and deployed some app on heroku. If not, please refer https://id.heroku.com/signup or https://devcenter.heroku.com/articles/git. Then setup the heroku app:

heroku create --stack 
git push heroku master 
heroku ps:scale web=1

Now, you will need to setup your HEROKU_URL variable.

heroku config:add HEROKU_URL=

Work in Progress ...




Visit the archives!