Created
March 21, 2012 18:32
-
-
Save damien/2150871 to your computer and use it in GitHub Desktop.
Collect records and save them as a list of URLs from within the rails console.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target = URI.parse("http://www.your-host.org") | |
petitions = Petition.select([:id, :slug]).limit(10) | |
urls = petitions.map { |p| app.url_for(:subdomain=>"www", :action=>"show", :controller=>"petitions", :host => target.host, :id => p.slug) } | |
File.open('urls.txt') { |io| urls.each { |u| io.puts u } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rails.app.routes.url_helpers.petition_url(petition) might be more correct