title: How can I add new attributes to my rails models?
body: <p>I created a model using: <code>rails g model category</code>
  Now I want to add some attributes to that model like a name</p>
  
  <p>so I went to the model and added the line <code>attribute :name</code></p>
  
  <pre><code>class Category &lt; ApplicationRecord
    attribute :name
    #has_many :posts
  end
  </code></pre>
  
  <p>This is how my Controller looks like:</p>
  
  <pre><code>class CategoriesController &lt; ApplicationController
  
    #def permitted_params
     # params.require(:category).permit(:name)
    #end
  
    def index
  
    end
  
    def new
    end
  
    def create
      #category.create(permitted_params)
    end
  
    def edit
    end
  
    def update
    end
  
    def show
    end
  
    def destroy
    end
  end
  </code></pre>
  
  <p>Then I run the command : <code>rails db:migrate</code> and I wanted to add some stuff to my database to test it out.</p>
  
  <p>I used the rails console and tryed to add a category:</p>
  
  <p><a href="https://i.stack.imgur.com/HsI9P.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HsI9P.jpg" alt="Console output"></a></p>
  
  <p>What do I need to do to write the name into the database?</p>