Skip to content

Instantly share code, notes, and snippets.

@eclubb
Created December 17, 2011 05:18
Show Gist options
  • Save eclubb/1489315 to your computer and use it in GitHub Desktop.
Save eclubb/1489315 to your computer and use it in GitHub Desktop.
rails generate migration add_image_id_to_blog_posts image_id:integer
rake db:migrate
Override the blog category model and add:
belongs_to :image
Override the blog category form and add an image picker to it:
<div class='field'>
<%= f.label :image -%>
<%= render :partial => "/shared/admin/image_picker", :locals => {
:f => f,
:field => :image_id,
:image => f.object.image,
:toggle_image_display => false
} %>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment