Darn it! subdomain specific header logos?

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

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.

Thoughts?

christopher,

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.

-christos

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs