Posts

Showing posts from May, 2013

Rake Routes for a Single Controller

You can list routes in your Rails application with:
rake routes If in-case you were looking for some specific route and grep doesn't solve your problems
rake routes | grep 'users' Here is a tip which you can try
rake routes CONTROLLER=controller_name

Handling JavaScript Confirm in Selenium and Capybara

page.driver.browser.switch_to.alert.accept This will accept the confirm box.

Public wildcard domain name that resolves to IP address 127.0.0.1

These are the various options for the public wildcard domain, It's good for testing sub-domains on localhost. So we don't need to make any sort of changes in hosts file.
lvh.me 42foo.com smackaho.st

Passing command line arguments to a rake task

Creating a rake task
desc "Description of what this task does" task :myraketask => :environment do .. .. end Once you have created a rake file(File with extension as .rake) and placed in /lib/task folder in your application.You can check rake -Tfor all the avaliable tasks, Your custom task will also be listed here with the description you have mentioned.
So this is the general way of using your rake task.
rake myraketask And if you wanted to pass any sort of arguments to your rake task , you can do this by
rake myraketask foo=bar So the argument foo can be accessed by
ENV['foo']in your task.