Sunday, 2 June 2013

Change a Constant Name in Loop whit variable Rails

Change a Constant Name in Loop whit variable Rails

Have how modify a name of constant in a loop ? If i make correctly this name ?
I have this attributes in my Model
image_1
image_2
image_3
image_4
image_5
image_6
image_7
image_8
and try make a loop change the name of method in helper, but i get error syntax.
  def carousel_items(product)
    @x= image_;
    @i= 1
    content_tag(:div,:class => "item") do
      7.times do
        product.(@x.to_s<<@i.to_s).present?
          return image_tag product.(@x.to_s+@i.to_s).url
        @i =+ 1
      end
    end
  end
Im try use + and << but not help me, someone sugestion please ?

No comments:

Post a Comment