Take the 2-minute tour ×

I am manipulating the resize/fill of image based on usage_tag field. A location can have many images. The issue is images not got resized. When i am raising model to yaml, it shows nil for every field.

Answer asap :(.

in my ImageUploader

process :scale

  def scale
    manipulate! do |img|
      raise model.to_yaml
      if model.usage_tag == "logo"
        #raise model.to_yaml
      elsif model.usage_tag == "thumbnail"

And below is the form :

    <%= form_for([:admin,@location]) do |f| %>

    <div class="field">
      <%= f.label :state %><br />
      <%= f.text_field :state %>
    <div class="field">
      <%= f.label :country %><br />
      <%= f.text_field :country %>
    <div class="images">
      <%= f.fields_for :location_images do |f2| %>
          <div class="field">
            <%= f2.file_field :image %>

            <%= f2.object.usage_tag if f2.object.usage_tag %>
            <%= f2.text_field :usage_tag %>
            <%#= deal_image.check_box :_destroy %>
      <% end %>
  <div class="actions">
    <%= f.submit %>
share|improve this question
I need answer :). –  geekdeepak Mar 28 '13 at 11:57
add comment

1 Answer

Rather than putting the condition inside the process block you could create version for each type and use the version :if option to do the condition.


share|improve this answer
But I do not want to waste the space by creating version and keep original files as well. I only want one image that is cropped as per usage_tag, logo, thumb or default. –  geekdeepak Mar 28 '13 at 18:17
add comment

Your Answer


