Skip to content
Image asset handing for ActiveRecord and Rails
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
generators/graffic
lib
tasks
test
.gitignore
.manifest
CHANGELOG.rdoc
MIT-LICENSE
README.rdoc
Rakefile
graffic.gemspec
init.rb
uninstall.rb

README.rdoc

Graffic

Graffic is an ActiveRecord class that helps you work with and attach images to other ActiveRecord records.

Example

# models/profile_photo.rb
class ProfilePhoto < Graffic
  size :medium, :width => 48, :height => 48, :format => :jpg
end

# models/user.rb
class User < ActiveRecord
  has_one :profile_photo
end

# views/users/_edit.html.erb
<% form_for @user do |f| %>
  <% f.fields_for :profile_photo do |p| %>
    <%= p.label :file, 'Profile Photo' %>
    <%= p.field_field :file %>
  <% end %>
<% end %>

Copyright © 2009 Jeremy Boles, released under the MIT license

Something went wrong with that request. Please try again.