Skip to content

Instantly share code, notes, and snippets.

@joselo
Created January 10, 2012 17:07
Show Gist options
  • Save joselo/1590040 to your computer and use it in GitHub Desktop.
Save joselo/1590040 to your computer and use it in GitHub Desktop.
<% @models.each do |model| %>
<% if model.image_models.first %>
<% unless model.image_models.first.document_file_name.blank? %>
<%= image_tag model.image_models.first.permalink %>
<% end %>
<% end %>
<% end %>
#Cambiar en el model.rb
has_many :image_models, :as => :owner, :dependent => :destroy, :order => 'created_at DESC'
#por
has_many :image_models, :as => :owner, :dependent => :destroy, :order => 'created_at ASC'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment