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
                To add a scaffold, right-click on Controllers folder in the Solution Explorer and select Add → New Scaffolded Item. It will display the Add Scaffold dialog.
Now let’s build a solution and you will see the message when the project is successfully build. To add a scaffold, right-click on Controllers folder in the Solution Explorer and select Add → New Scaffolded Item. It will display the Add Scaffold dialog.
Here we will learn what is scaffolding in asp.net mvc and types of controller scaffoldings in asp.net mvc. Scaffolding is a technique used in asp.net mvc to generate basic CRUD operation (Create, Delete, Details, Edit, and List) from Model,.
A feature called Scaffolding creates a Controller and several Views on basis of a model. How does this feature work and how can we tell Visual Studio to generate the desired code for us? I’m going to tell you about it in this post.
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]
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