Forum: Ruby on Rails darn it!! subdomain specific header logos?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8a9089718a696246851908ac59390a2c?d=identicon&s=25 christopher (Guest)
on 2007-02-17 19:12
ok, forgive my ignorance as a peer is trying to use subdomain specific
logos for each subdomain site that we are implementing...

we're frustrated because @site.subdomain should return the subdomain
used for each subdomain. You just need something unique for each site,
then do stuff like:
<%= image_tag “logos/#{@site.subdomain}.gif” %>

to create for example
<img src=”/images/logos/prod.gif” />

on the ‘prod’ site.

we are using <%= image_tag  "logos/#{@site.subdomain}.png" %>  and we
can see the header image but no logo image... the code is outputting
nothing at all, not even an incorrect image tag. we originally tried
using the variable to call divs rather than images, but that had the
same no output problem, then we moved back to just an image call, still
no luck.

67f61f0c385168c4b2e5b8fd733c397f?d=identicon&s=25 Christos Zisopoulos (Guest)
on 2007-02-17 19:22
(Received via mailing list)

You can get the subdomain from the request object in the context of a
controller (or a view) like this:

  <%= image_tag “logos/#{request.subdomains.first}.gif” %>

What is @site ? Do you define it somewhere? If so then you can assign
the subdomain in your controller like this, provided @site is a hash,
or an object with a subdomain attribute.

  @site.subdomain = request.subdomains.first

I would suggest in application.rb, so that it is available to all
your controllers.

This topic is locked and can not be replied to.