-
-
Save kivanio/05f1d0aa4bea3997b587 to your computer and use it in GitHub Desktop.
This file contains 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
# active_admin and formtastic seem kinda picky about displaying both the | |
# image and the file input together here... in fact, it seems like this | |
# is the ONLY way to do this? Adding anything else after the image_tag squashes it. | |
ActiveAdmin.register Film do | |
form do |f| | |
f.inputs "Film" do | |
f.input :title | |
end | |
f.has_many :stills do |film_still_form| | |
if film_still_form.object.new_record? | |
film_still_form.input :photo, :as => :file | |
else | |
image_tag film_still_form.object.photo.url(:thumbnail) | |
end | |
end | |
f.buttons | |
end | |
end | |
ActiveAdmin.register Still do | |
belongs_to :film | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment