Mat Brown wrote:
> Your data model layer should not be aware of application state (or even
> assume it is part of a web app). So, this should be done from the
> controller/view layer.
> 
> On Feb 10, 2010 2:45 AM, "lunaclaire" <[email protected]> wrote:
> 
> I have a need to pass full, absolute urls to images for an interaction
> with Facebook. I dont think I can use the view helpers (e.g.
> image_tag) from the model though...
> 
> Is there a way to do this from the model (or less desirable, from the
> controller)?
> 
> or if I cant use image_tag, is there another way to build these urls
> from the model?
> 
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.

If interaction with Facebook requires an absolute path to an image, and 
this Facebook interaction is part of his app's "domain logic," a model 
is perfectly appropriate place for this...

To do what you're asking, you'll need to first set

config.action_controller.asset_host = "http://your_assets.domain";

Then, to use image_tag or image_path, include 
ActionView::Helpers::AssetTagHelper into your model (or extend some 
object with it).
-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to