amitava wrote:> Hi,
>
> I am facing a serious problem with file_column plugin. Though it is
> absolutely fine while uploading images, and the way it uploads the
> image on the file system and stores the file name in a database table
> is awsome. But while I try to get the image by passing its ID,
> surprisingly it returns the full absolute path rather than the image
> name! I would like to give a littel more description about the problem.
>
> There are two tables:- 1) items and 2)item_images
>
> In the first table only item name and description is stored while in
> the second table; the image name is stored along with the item_id from
> the first table. I am using the following code to access the image from
> database
>
> itm = ItemImage.find_by_item_id(id).image # image is the column for
> image name
>
> Running this query returns something like
> "public/item_image/image/1/Sample.jpg" instead of
> "/item_image/image/1/Sample.jpg".
>
> Any help would be g
>
> Thanks
> Amitava
You could simply add a:
.gsub(/^public/, '''')
to fix the file path.
Although, if file_column continues to be to much of a pain, try
FlexImage instead.
http://beautifulpixel.com/flex_image/index.html
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---