A Rails application needs some data to exist in database before the application can be run. It is called ‘seed’ data.
This post shows how to create a rake task that loads ‘seed’ data. Data is stored in *.yml files.
Rails: clear old sessions stored in database
Sessions in Rails application can be stored in a database (as well as in cookies). I used to store session data in a table in database.
Sessions table may grow very large because Rails doesn’t have a built-in mechanism to clear old session data.
So you need to remove old sessions rows from database manually.
Rails 3 Nested Models in one form using Formtastic and Cocoon gems
This post shows how to handle nested models in one form with the parent model.
Showing images in GridView with multiple columns [Android]
This post shows how to get GridView with images and show images in multiple columns.
If you are looking for showing images in ListView – read this tutorial.
ListView with Images [Android]
This post shows how to get ListView with images using ArrayAdapter with custom objects.
In this example we will show a list of products with image and title in ListView.
Redirect from WWW to a non-WWW version of site in Rails
It is good practice to make your site available by both www.example.com and example.com URLs. But to prevent the duplication of pages (http://www.example.com/somepage/ and http://example.com/somepage are the same) we should have one version of URL (with WWW or without) and redirect from another version to the chosen one (from www to non-www or vice versa).
How to create your own Ruby gem
This post is the guide to creating your own gem for Rails.
Using CDN with Rails assets
Rails disable logging of asset pipeline messages
There are many assets related log messages in log file. It causes Rack to use the Rails logger very  frequently.
Password protecting pages of Rails App
Often it is needed to close a whole app or some pages of a Rails app in Beta mode. A simple and quick way is using http authentication. So users (beta testers, admin) can access a Rails app by entering a single username and password.
Continue reading