I can't understand what's happening, when I ask for index action I receive ActionController::UnknownFormat, even existing a index.js file inside views/products folder. Anyone can help me to figure out what I'm missing out? I'm using Rails 4 and Ruby 2.0.0-p247.
class ProductsController < ApplicationController
respond_to :js
def index
@products = Product.published.newest.page(params[:page])
respond_with @products
end
end
You should specify the format on the petition, i.e:
get :show, :user_id => user_id, :format => :json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With