ruby on rails 3 - Carrierwave is not displaying file path in xml view - Is this normal? -


i've got app works carrierwave. can @product.image.url give me path url of stored image.

however, when browse products#show (i.e. http://localhost:3000/products/1.xml), displays correctly except image.

in console, @product.image.url, returns:

"https://bucket_name.s3.amazonaws.com/uploads/products/2/prod1.jpg"  

the image displays name , extension. not path. normal?

for example, xml looks like:

product>   <attachment>prod1.jpg</attachment>   <cached-slug>adsfsadf</cached-slug>   <category-id type="integer">1</category-id>   <company-id type="integer">1</company-id>   <created-at type="datetime">2011-05-10t05:10:35z</created-at>   <description>description here</description>   ... 

yep, think carrierwave generating url dynamically (within method), can change or override way computed.

format.xml  { render :xml => @product.to_xml(:include => {:attachment => {:only => :url}}) } 

edit : works me :

format.xml  { render :xml => @product.to_xml(:except => :attachment, :methods => :attachment_url) } 

Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

c# - how to write client side events functions for the combobox items -

ssh client with paramiko (python) -