Empty (but working) show method on controller generated via scaffolding?
ruby-on-rails, ruby-on-rails-4
Solution
If you are using rails 4 then there should have some before action method which is doing the magic for you please check in the respective controller.
It should be like `before_action :set_product, :only => [:show, :edit, :update, :destroy]`
Problem
How is that the `show` method on a controller class generated via `rails generate scaffold xxx` empty / contains no code? Where is the code for showing individual records via URL e.g. `/my_rails_app:3000/xxx/1` stored? The method should, at the very least, looks like this IMO: ``` class ProductController # GET /students/1 # GET /students/1.json def show @item = Product.find(params[:id]) render @item end end ``` but instead it is completely empty: ``` class ProductController # GET /students/1 # GET /students/1.json def show end end ```