You should be able to do something like this in your respond_to
block:
respond_to do |format|
format.json
render :partial => "users/show.json"
end
which will render the template in app/views/users/_show.json.erb
.
More Related Contents:
- What is the difference between
- How do I parse JSON with Ruby on Rails? [duplicate]
- How to “pretty” format JSON output in Ruby on Rails
- How to convert a ruby hash object to JSON?
- POST json to rails server
- JSON encoding wrongly escaped (Rails 3, Ruby 1.9.2)
- Rails Object Relationships and JSON Rendering
- ‘sudo gem install’ or ‘gem install’ and gem locations
- ActiveRecord: size vs count
- OO Design in Rails: Where to put stuff
- Altering the primary key in Rails to be a string
- Use YAML with variables
- STI, one controller
- LEFT OUTER joins in Rails 3
- Error when running rails app – ExecJS::RuntimeError
- How do I “activate” a different version of a particular gem?
- POST JSON to API using Rails and HTTParty
- How to `bundle install` when your Gemfile requires an older version of bundler?
- Find unused code in a Rails app
- Paginating an Array in Ruby with will_paginate
- Convert HTML to word file ?
- undefined method `visit’ when using RSpec and Capybara in rails
- Ruby on Rails Callback, what is difference between :before_save and :before_create?
- How to URL encode a string in Ruby
- What is the difference between Gemfile and Gemfile.lock in Ruby on Rails
- Parametrized get request in Ruby?
- Why is respond_with being removed from rails 4.2 into it’s own gem?
- Customizing Devise error messages in Rails 3?
- Rails attachments inline are not shown correctly in gmail
- How do I use CSS with a ruby on rails application?