Geocoder is a Rails Gem which helps you to manipulate location in your Rails application. It is written by Alex Reisner. Thanks for his work and you can find out more details at Github – alexreisner / geocoder.
Let’s try it now. Continue reading Rails – Find Location using Geocoder
I have been working on Rails for more than half year and i do file editing with vi at server side most of the time. vi is a great tool but it is not convenient for editing multiple files which is very common in programmer. In the past, I had to close the file, cd to another directory and opened another file for editing. Continue reading NERDTree – The File Explorer in vi/vim
During development we always need to print the objects in views for debug. In Rails, there are two ways you can print the Ruby objects. Continue reading Rails – Debug Your Application in View
By default, Devise will redirect you to the root path after sign in. but sometimes we would like to redirect to the previous page where the anonymous user wanna access. This can be done by the following. Continue reading Rails – Redirect Previous Page After Devise Sign In
The flash message is useful for notifying user. Rails 3 allows simple manipulation of the flash message.
1. Add the flash message in app/views/layouts/application.html.erb Continue reading Rails – Show Flash Message
Last time we should you how to create the mock user using the Factory Girl ♥ Rails gem.
Rails – Create Mock Data for RSpec
Recalled that spec file. Continue reading Rails – Devise User Sign In for RSpec
When running the test cases, most likely we need some mock data to test the functionality of our code. The factory_girl_rails gem is useful for creating mock data for testing purpose. Continue reading Rails – Create Mock Data for RSpec
According to the documentation in the Devise home page, we can use the following before_filter to control the user access on specific controller functions.
But when i try to test the controller function in RSpec, i got the following error.
Failure/Error: post :create
undefined method `authenticate!’ for nil:NilClass Continue reading Rails – RSpec Test with Devise
Previous related posts:
By default, the users table in Devise only contains the email and password fields in user profile. Most likely we need to add our custom fields such that we can store more user information. The following steps show you how to add a username field in the users model. Continue reading Rails – Add Custom Fields to Devise User Model