views:

26

answers:

1

I want a link to remote to have a rel tag, because I want to use facebox with it.

I had it working with a regular link to... but I needed the link to remote to handle the event that a user doesn't have javascript enabled.

this, currently does't work (except for the non-javascript part )

<%= link_to_remote "Ask a Question", 
            {:url => 
                {:action => :ask_question,
                :id => @container.id.to_s,
                :javascript_disabled => false
                }, :rel => 'facebox'},
            :href => url_for(
                            :controller => :view,
                            :action => :ask_question,
                            :id => @container.id.to_s,
                            :javascript_disabled => true) %>
A: 

In link_to_remote you pass in HTML options (like rel) in the third argument. In your code you're passing it in the second (i.e. the first hash). Try this instead:

<%= link_to_remote("Ask a Question", 
      { :url => { :action => :ask_question,
                  :id => @container.id.to_s,
                  :javascript_disabled => false
                }
      },
      { :href => url_for( :controller => :view,
                          :action => :ask_question,
                          :id => @container.id.to_s,
                          :javascript_disabled => true ),
        :rel => 'facebox'
      }
    )
%>

(As you know, some of the parentheses and curly braces are optional, but here I've included all of them for clarity, and probably would keep them in since you're passing a lot of complex arguments here.)

Jordan
While, thats ok for having javascript disabled (cause the href does the same thing regardless of the rel being there), I need the rel to be with the first section so that that page that the link is pointing at displays in the facebox popup. =\
DerNalia