File_column plugin and instance variables

To make file_column work I have to copy my local variable back to an
instance variables like this:

<% for product in @products
@product = product %>

<%= image_tag url_for_file_column('product', 'image_url') %>

This is needed because file_column specifically looks for the instance
version of the variable.

def url_for_file_column(object, method, subdir=nil)
case object
when String, Symbol
object = instance_variable_get("@#{object.to_s}")

Is this normal or is there some way to fix this in file_column?

Jon S.
[email protected]

Check out the Wiki page for a better explanation/solution.

On Jan 16, 2006, at 9:41 PM, Jon S. wrote:

[email protected]

Rails mailing list
[email protected]

  • Bill

On 1/16/06, Bill P. [email protected] wrote:

<% for product in @products
object = instance_variable_get("@#{object.to_s}")

IIRC, file_column trunk cheats and lets you pass in the object itself:

<%=url_for_file_column product, “image” %>

Also, you could just do what I do and:

<% for @product in @products %>

Kyle M.
Chief Technologist
E Factor Media // FN Interactive
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs