Skip to content

Instantly share code, notes, and snippets.

View listenlight's full-sized avatar

Jesse Crockett listenlight

  • Texas
  • 23:25 (UTC -05:00)
View GitHub Profile
- form_for @demo, :html => { :multipart => true } do |f|
= f.error_messages
%p
= f.label :name
%br
= f.text_field :name
- f.fields_for :images do |builder|
%p
- if builder.object.new_record?
= builder.label :image, "Image"
# download, from_repo, and commit_state methods swiped from
# http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"
# download, from_repo, and commit_state methods swiped from
# http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"