Sha256: 1b2d2aed2f6f01d64a829c1d4dff317d11c5ad5ad3a747a38fad5a21a4ba6d26

Contents?: true

Size: 1.05 KB

Versions: 13

Compression:

Stored size: 1.05 KB

Contents

gem 'dragonfly', :path => File.expand_path('../..', __FILE__)
generate "dragonfly"
generate "scaffold", "photo image_uid:string image_name:string"
rake "db:migrate"
route %(
  get "text/:text" => Dragonfly.app.endpoint { |params, app|
    app.generate(:text, params[:text])
  }
)
route "root :to => 'photos#index'"
run "rm -rf public/index.html"

inject_into_file 'app/models/photo.rb', :after => "class Photo < ActiveRecord::Base\n" do
  %(
    attr_accessible :image rescue nil
    dragonfly_accessor :image
  )
end

gsub_file 'app/views/photos/_form.html.erb', /^.*:image_.*$/, ''

inject_into_file 'app/views/photos/_form.html.erb', :before => %(<div class="actions">\n) do
  %(
    <div class="field">
      <%= f.label :image %><br>
      <%= f.file_field :image %>
    </div>

    <%= image_tag @photo.image.thumb('100x100').url if @photo.image_uid %>
  )
end

gsub_file "app/controllers/photos_controller.rb", "permit(", "permit(:image, "

append_file 'app/views/photos/show.html.erb', %(
 <%= image_tag @photo.image.thumb('300x300').url if @photo.image_uid? %>
)

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
dragonfly-1.0.12 dev/rails_template.rb
dragonfly-1.0.11 dev/rails_template.rb
dragonfly-1.0.10 dev/rails_template.rb
dragonfly-1.0.9 dev/rails_template.rb
dragonfly-1.0.8 dev/rails_template.rb
dragonfly-1.0.7 dev/rails_template.rb
dragonfly-1.0.6 dev/rails_template.rb
dragonfly-1.0.5 dev/rails_template.rb
dragonfly-1.0.4 dev/rails_template.rb
dragonfly-1.0.3 dev/rails_template.rb
dragonfly-1.0.2 dev/rails_template.rb
dragonfly-1.0.1 dev/rails_template.rb
dragonfly-1.0 dev/rails_template.rb