title: How can I "initialize" instance variable?
body: <p>I am just trying to study about Rails.</p>
  
  <p>Everytime I send the get request through postman, initialize method is called, so I cannot maintain @data Array because @data is initialized at every request.
  Is there any way to initialize @data once, and let create, update, destroy methods work properly?</p>
  
  <pre><code>class BooksController &lt; ApplicationController
      skip_before_action :verify_authenticity_token
  
      def initialize
          super
          @data = [
              { title: "Harry Potter", author: "J.K Rowling" },
              { title: "Name of the wind", author: "Patrick Rothfuss" }
          ]
      end
  
      def index
          render json: @data
      end
  
      def create
          @data.push(params[:book])
          render json: @data
      end
  end
  </code></pre>