On 22 Mar 2011, at 05:42, "sol.manager" <sol.mana...@gmail.com> wrote:

> I am trying to add a condition so a "back" button does not appear if
> the user arrived at the current page directly from a link offsite
> (eg., a link from a tweet). I do want the button to appear if the user
> arrived at the page from another page on our site:
> 
> From what I have read this seems like where I would use
> url_options(ActionView::Helpers::URLHelper. The code below does not
> work and I am uncertain why. Am I barking up the right tree or not
> even in the ballpark?
> <li><% unless request.env["HTTP_REFERER"] is not set or is blank %><%=
> link_to image_tag("/images/icons/
> mico_back.png"), :action=>"results_bounce" %><% end %></li>

"is not set or is blank" isn't Rails code -- it's just English. I preume you're 
getting a runtime error on this line?

Rails provides a #blank? method on objects that returns true if they are nil or 
empty. So you could try:

unless request.env["HTTP_REFERER"].blank?

As an aside, when you're posting about something like this, it's helpful for us 
to see the actual error message that Ruby gave you, rather than just posting 
"it does not work".

Thanks,
Chris

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to