# Problem with file\_column url generator

**URL:** <https://www.ruby-forum.com/t/problem-with-file-column-url-generator/112382>\
**Category:** Rails\
**Created:** [August 18, 2007, 3:16am UTC](https://www.ruby-forum.com/t/problem-with-file-column-url-generator/112382 "2007-08-18T03:16:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gordon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3da27b/32.png) [@gordon](https://www.ruby-forum.com/u/gordon)\
**Post date:** [August 18, 2007, 3:16am UTC](https://www.ruby-forum.com/t/problem-with-file-column-url-generator/112382/1 "2007-08-18T03:16:06Z")

</div>

Hi,

I have the following in a viewer  
Here, @lst = Homework.find(:all) is an array of homeworks. I checked  
this this is correct.  
Based on the error below, somehow, the url\_for\_file\_colum does not  
like to act on the model element.  
I checked the source code to url\_for\_file\_column, and the problem is  
with instance\_variable\_get().  
I have no idea wat is going on! Any help is appreciated. Gordon.

* * *

\<% @lst.each do |hwk| %\>

\<%= link\_to File.basename(hwk.file\_name), url\_for\_file\_column(hwk, "file\_name") %\>

\<% end %\> ---------------------

The File.basename(xxx) prints properly. However, I get the following  
message for url\_for\_file\_column:

* * *

4: \<%# for hwk in @list %\>  
5: \<% @lst.each do |hwk| %\>  
6:

7: \<%= link\_to File.basename(hwk.file\_name), url\_for\_file\_column(hwk,  
“file\_name”) %\>  
8:

  
9: \<% end %\>  
10: \</div class=“list”\>

RAILS\_ROOT: script/…/config/…  
Application Trace | Framework Trace | Full Trace

vendor/plugins/rails\_file\_column/plugins/file\_column/branches/kyle/lib/  
file\_column\_helper.rb:58:in `instance_variable_get' vendor/plugins/rails_file_column/plugins/file_column/branches/kyle/lib/ file_column_helper.rb:58:in`url\_for\_file\_column’  
#{RAILS\_ROOT}/app/views/homework/list.rhtml:7:in  
`_run_rhtml_47app47views47homework47list46rhtml' #{RAILS_ROOT}/app/views/homework/list.rhtml:5:in`each’  
#{RAILS\_ROOT}/app/views/homework/list.rhtml:5:in  
`\_run\_rhtml\_47app47views47homework47list46rhtml’

---

<div class="post-metadata">

**Author:** ![gordon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3da27b/32.png) [@gordon](https://www.ruby-forum.com/u/gordon)\
**Post date:** [August 18, 2007, 5:16pm UTC](https://www.ruby-forum.com/t/problem-with-file-column-url-generator/112382/2 "2007-08-18T17:16:01Z")

</div>

## gordon wrote:

> \<% @lst.each do |hwk| %\>
> 
> \<%= link\_to File.basename(hwk.file\_name), url\_for\_file\_column(hwk, "file\_name") %\>
> 
> \<% end %\>

Active Record form helper always require an instance variable name  
for their first arguments. So write:

\<% @lst.each do |@hwk| %\>

\<%= link\_to File.basename(@hwk.file\_name), url\_for\_file\_column(:hwk, "file\_name") %\>

\<% end %\>

–  
We develop, watch us RoR, in numbers too big to ignore.
