Topic: Simple Questions...(Is this the right place?) @file_data

Hi, I am new to rails.  I have been reading on books and following the examples.

I was following an example on file upload.  And this variable was used: @file_data

I see no def for this variable.  So is it internal to rails?  If so, what if I am uploading multiple files?  Does it become an array automatically?

Not sure if this is a right place to ask such simple questions.  Please do refer me to the right forum if this is not.

Thanks!

Re: Simple Questions...(Is this the right place?) @file_data

Hello bro..............................

May be it will help for you.................

http://railscasts.com/episodes/134-pape … oplay=true

Re: Simple Questions...(Is this the right place?) @file_data

Hi bharat_soni,

Thanks for the introduction to paperclip.

I re-read the upload example I was looking at more carefully.  It turns out the @file_data variable was set my the photo method. And the example set file_data was created by rails:

def photo=(file_data)
    unless file_data.blank?
      # store the uploaded data into a private instance variable
      @file_data = file_data
      ...

I changed file_data to file_data2 like
def photo=(file_data2)
    unless file_data2.blank?
      # store the uploaded data into a private instance variable
      @file_data = file_data2
      ...

The program still runs.  How does rails know that?  Do the parentheses have any special meaning?

Thanks