paperclip - path in image.rb
===

I am using paperclip for uploading images in my rails application. 

I have 2 models 'Image' and 'Book' where one book can have many Images and image belongs_to Book.
In my 'images' table, I have 4 columns:

- id
- book_id
- data_file_path
- data_file_name

column 'data_file_path' stores the path of the image and column 'data_file_name' stores the image name and extension

In my image.rb file, I have the following lines of code:

    has_attached_file :data, :path => "http://localhost/book/book_images/:data_file_path/:book_id/:style/:basename.:extension",
                             :url =>    "http://localhost/book/book_images/:data_file_path/:book_id/:style/:basename.:extension"


Notice the ':data_file_path' in the code above. 

In my view, when i do <%=image.data.url(:thumb)%> i get the following path:

    http://localhost/book/book_images/data_file_path/9124/thumb/1897_EK91_201107.jpg 

Instead of retrieving the data_file_path value from the d-base, it's displaying the variable name.

How to I get the data_file_path value in the url.

Thanks a lot for your precious help. I have struggling with that since a while now.



