Maurício Linhares wrote:
> Without looking at your routes and code it's really had to find a 
> reason.

A big part of the issue is that the initial problems are using standard 
code, the hacks only come into play to make things work.

First issue:
$("#terms-of-use").click(function() {
  var url = this.href + ".js"  // <= hack #1 to allow format.js block to 
be called
  $.get(url, function() {
    ..
  })
})

# controller
def terms_of_use
    respond_to do |format|
      format.html {}
      format.js {render :action => "terms_of_use", :layout => false}
    end
  end

Second issue
Enter http://foobar.com/schedule/1.xml into browser

#controller
def schedule
  @todos = User.find(params[:id]).todos
  respond_to do |format|
    format.html {}
    format.xml { render :xml => @todos.to_xml }
  end
end

# routes.rb

# this won't work to allow the xml request to be made
map.schedule "schedule/:id", :controller => "main", :action => 
"schedule"

## Hack #2: adding the format option will allow it to work
map.schedule "schedule/id.:format", :controller => "main", :action => 
"schedule", :format => "html"

-- 
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 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