All posts by Morshed Alam
Creating authentication from scratch in Rails 3.1
There are some popular authentication libraries like devise, Authlogic, Restful Authentication, Clearance in Ruby on Rails. But, you can implement of your own as well. Here, I’m explaining few simple steps to create your own authentication system in Rails 3.1. First, Create Run following commands from command prompt and then copy the codes in the…
Rename rails3 application
Just published new version of rename gem with following changes: Sanitize new name Search/Replace module name in all files under root and config Change session key Change directory name InstallationAdd this line to your application’s Gemfile: gem ‘rename’ Uses rails g rename:app_to NewNamerails g rename:app_to “New-Name”
Website thumbnail using API
Just recently, I have developed a page cast module for Greenarrow.com to show users profile’s thumbnail image on the fly. Before doing that I have googling and found couple of good solutions: thumboo.com webthumbnail.org and webthumb.bluga.net etc. webthumb.bluga.net is the best solution in between those though it’s depend on windows hosting. You can have a…
Drag and drop from scratch using JavaScript
An example code to implement drag-ability in to an HTML element from scratch without using JavaScript library. JavaScript functions to provide drag-ability: function DDElement(ele, event) { addEvent(ele, “mousedown”, downHandler, true); addEvent(document, “mouseup”, upHandler, true); if (event.stopPropagation) event.stopPropagation(); else event.cancelBubble = true; if (event.preventDefault) event.preventDefault(); else event.returnValue = false; function upHandler(e) { e = e ||…
Document management using jQuery
Just added a prototype site of to manage document using Ruby on Rails: Gems Uses jQuery-File-Upload CarrierWave Fog Twitter Bootstrap Haml Simple Form Rspec factory_girl Click here to contribute/checkout.
Google weather API not working
Recently google has shutdown their weather API silently which breaks one of my clients first page application name Greenarrow.com. I think many developers and users were (and still are) outraged, but at least they have some time to breathe as because iGoogle isn’t going away until November 1, 2013. So, there are still one year…
Javascript not working – NetworkError: 404 Not Found
Yesterday, I have deployed an application on Ubuntu server but the javascript was no longer working after configuring the virtual host. I have taken following steps to find the problem: Viewed the HTML source code using firebug and found page not found error Checked the .htaccess file, but there were no problem Tried a test…
Undefined local variable or method `version_requirements’ for …
I was getting the error while installing an older rails application. After googling I’ve got the solution from a discussion thread to add following block in right before the initialization in to config/environment.rb and worked for me. if Gem::VERSION >= “1.3.6” module Rails class GemDependency def requirement r = super (r == Gem::Requirement.default) ? nil…
How to rename Rails3 application
A Rails3 application name are using as a Ruby name space for entire application and throughout the project tree as well. So, If anyone later decide to change the project name, then have to replace the name in the following files: Rakefileconfig.ruconfig/routes.rbconfig/application.rbconfig/environment.rbconfig/environments/development.rbconfig/environments/test.rbconfig/environments/production.rbinitializers/secret_token.rbinitializers/session_store.rb You can run following command in your project root, to find out the…
Date Time difference and a new time adding intervals in days, week, month etc.
I’ve written a DateTime helper class to get: DateTime difference as an object and string DateTime details as an array and object Repeat DateTime by minute, hour, day, week, month, year using interval etc. You can checkout the repository from github.com. Uses: View Demo