title: Rails: ArgumentError in PostsController#create wrong number of arguments (1 for 0)
body: <p><a href="https://github.com/LaFrish/wdi8-yearbook" rel="nofollow">Github Repo</a>
  Hi, I'm a noob and need help. Making a yearbook for my bootcamp class and having some hiccups. Current error is: </p>
  
  <pre><code>ArgumentError in PostsController#create
  wrong number of arguments (1 for 0)
  
  Extracted source (around line #63):
  61
  62
  63
  64
  65
  66
  
  
    private
    def post_params
      params.require(:post).permit(:name, :body)
    end
  end
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/wqmHV.png" rel="nofollow">screenshot of error message</a></p>
  
  <p>Wdiers are my users. These wdiers are students and instructors. Currently, I am just trying to add a post onto the wdier show page. I currently have a post on the page for a test wdier that came from my seed file. The error is when I was trying to create a new post. I was able to get to the form page and the error came after I submitted the post. (I had posts called comments originally but changed it to posts and will have comments as a reply to those posts) </p>
  
  <p>Also, want to note that I am using devise, in case that matters.</p>
  
  <p>Here are my pages: </p>
  
  <p>WDIer controller
      class WdiersController &lt; ApplicationController</p>
  
  <pre><code>  def index
      @wdiers = Wdier.all
    end
  
    def new
      @wdier = Wdier.new
    end
  
    def create
      @wdier = Wdier.create!(wdier_params)
  
      redirect_to wdiers_path(@wdier)
    end
  
    def show
      @wdier = Wdier.find(params[:id])
    end
  
    def edit
      @wdier = Wdier.find(params[:id])
    end
  
    def update
      @wdier = Wdier.find(params[:id])
      @wdier.update(wdier_params)
  
      redirect_to wdiers_path(@wdier)
    end
  
    def destroy
      @wdier = Wdier.find(params[:id])
      @wdier.destroy
  
      redirect_to wdiers_path(@wdier)
    end
  
    def wdier_params
      params.require(:wdier).permit(:name, :img_url, :squad_name, :squad_id, :quote, :teaching, :memory, :favlang, :wisewords, :tag_list,:github_url, :portfolio_url, :project1_url, :project2_url, :project3_url, :quote, :q1, :q2, :q3, :fb, :linkedin, :email, :role,  :student_id, :instructor_id)
    end
  end
  </code></pre>
  
  <p>Post controller</p>
  
  <pre><code>class PostsController &lt; ApplicationController
  
    def index
      @posts = Post.all
    end
  
    def show
      @wdier = Wdier.find(params[:wdier_id])
      @post = Post.find(params[:id])
    end
  
    def edit
      @wdier = Wdier.find(params[:wdier_id])
      @post = Post.find(params[:id])
    end
  
    def new
      @wdier = Wdier.find(params[:wdier_id])
      @post = Post.new
    end
  
    def create
      @wdier = Wdier.find(params[:wdier_id])
      @post = @wdier.posts.create!(post_params)
      @post = Post.new(params.require(:post).permit(:task))
      @post.save
      if @post.save
        flash[:alert] = "Post created successfully."
        redirect_to post_params([:wdier_id])
      else
        flash[:alert] = "Error creating post."
        redirect_to post_params([:wdier_id])
      end
    end
  
  
    def update
      @wdier = Wdier.find(params[:wdier_id])
      @post = Post.find(params[:id])
      if @post.user == current_user
        @post.update(wdier_params)
      else
        flash[:alert] = "Only the author of the post can edit it!"
      end
      redirect_to wdier_params(@wdier)
    end
  
    def destroy
      @wdier = Wdier.find(params[:wdier_id])
      @post = Post.find(params[:id])
      if @post.user == current_user
        @post.destroy
      else
        flash[:alert] = "Only the author of the post can delete"
      end
      redirect_to wdier_path(@wdier)
    end
  
    private
    def post_params
      params.require(:post).permit(:name,:body)
    end
  end
  </code></pre>
  
  <p>Post model</p>
  
  <pre><code>class Post &lt; ActiveRecord::Base
    belongs_to :instructors
    belongs_to :students
    belongs_to :users
    belongs_to :wdiers
    has_many :comments
  end
  </code></pre>
  
  <p>Wdier model</p>
  
  <pre><code>class Wdier &lt; ActiveRecord::Base
    belongs_to :squad
    belongs_to :instructors
    belongs_to :students
    has_one :codey
    has_many :comments
    has_many :posts
    has_many :negatives
    has_many :photos, through: :negatives
  end
  </code></pre>
  
  <p>Wdier show view: </p>
  
  <pre><code>&lt;section id="wdierShow"&gt;
  &lt;h1 class="page-header"&gt;&lt;%= @wdier.name %&gt;&lt;/h1&gt;
  &lt;div class="index"&gt;
  
  
    &lt;section&gt;
      &lt;div class="button"&gt;&lt;%= link_to "edit", edit_wdier_path(@wdier)%&gt;&lt;/h2&gt;&lt;/div&gt;
    &lt;/br&gt;
    &lt;div class="profileImg"&gt;
    &lt;%= image_tag @wdier.img_url %&gt;
  &lt;/div&gt;
    &lt;div class="topContainer"&gt;
      &lt;!-- &lt;h1&gt;&lt;%= @wdier.name %&gt;&lt;/h1&gt; --&gt;
    &lt;ul class="grid"&gt;
      &lt;%= @wdier.squad_id %&gt; &lt;/br&gt;
      &lt;%= @wdier.codey_id %&gt; &lt;/br&gt;
      &lt;%= @wdier.quote %&gt; &lt;/br&gt;
      &lt;%= @wdier.teaching %&gt; &lt;/br&gt;
      &lt;%= @wdier.memory %&gt; &lt;/br&gt;
      &lt;%= @wdier.favlang %&gt; &lt;/br&gt;
      &lt;%= @wdier.wisewords %&gt; &lt;/br&gt;
    &lt;/ul&gt;
    &lt;/div&gt;
    &lt;section id="photo"&gt;
      &lt;div class="photoGallery"&gt;
        &lt;h2&gt;Pics Please&lt;/h2&gt;
        &lt;button&gt; &lt;%= link_to "Add new photo", new_photo_path(@wdier) %&gt;&lt;/button&gt;
        &lt;ul&gt;
          &lt;li class="col-lg-3 col-md-4 col-sm-6 col-xs-12"&gt;&lt;% @wdier.photos.each do |photo| %&gt;
            &lt;%= image_tag photo.img_url %&gt;&lt;/li&gt;
            &lt;% end %&gt;
          &lt;/ul&gt;
          &lt;/div&gt;
  &lt;section&gt;
  &lt;/section&gt;
  &lt;section id="comment"&gt;
    &lt;div class="commentGallery"&gt;
      &lt;div class="overlay"&gt;
        &lt;h2&gt;keep in touch...&lt;/h2&gt;
  
  
  &lt;%= link_to "Add new comment", new_wdier_post_path(@wdier) %&gt;
  &lt;% @wdier.posts.each do |post| %&gt;
  
  &lt;p&gt;
    &lt;%= post.body %&gt;
  &lt;/p&gt;
  &lt;% if current_user &amp;&amp; current_user == post.user %&gt;
  &lt;%= link_to "Edit", edit_wdier_post_path(@wdier) %&gt; |
  &lt;%= link_to "Delete", wdier_post_path(@wdier), method: :delete %&gt;
  &lt;% end %&gt;
  &lt;/div&gt;
  &lt;% end %&gt;
  &lt;/div&gt;
  &lt;/section&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>Post new view:</p>
  
  <pre><code>&lt;%= form_for [@wdier, @post] do |f| %&gt;
    &lt;%= f.label :name %&gt;
    &lt;%= f.text_field :name %&gt;
    &lt;%= f.label :body %&gt;
    &lt;%= f.text_area :body %&gt;
    &lt;%= f.submit %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Schema: </p>
  
  <pre><code>ActiveRecord::Schema.define(version: 20160521153002) do
  
    # These are extensions that must be enabled in order to support this database
    enable_extension "plpgsql"
  
    create_table "comments", force: :cascade do |t|
      t.string  "name"
      t.string  "body"
      t.integer "wdier_id"
    end
  
    add_index "comments", ["wdier_id"], name: "index_comments_on_wdier_id", using: :btree
  
    create_table "instructors", force: :cascade do |t|
      t.string  "name"
      t.string  "img_url"
      t.string  "squad_name"
      t.string  "quote"
      t.string  "teaching"
      t.string  "memory"
      t.string  "favlang"
      t.string  "wisewords"
      t.string  "email"
      t.string  "password"
      t.integer "squad_id"
      t.integer "user_id"
      t.integer "wdier_id"
    end
  
    add_index "instructors", ["squad_id"], name: "index_instructors_on_squad_id", using: :btree
    add_index "instructors", ["user_id"], name: "index_instructors_on_user_id", using: :btree
    add_index "instructors", ["wdier_id"], name: "index_instructors_on_wdier_id", using: :btree
  
    create_table "negatives", force: :cascade do |t|
      t.integer "photo_id"
      t.integer "instructor_id"
      t.integer "student_id"
      t.integer "user_id"
      t.integer "wdier_id"
    end
  
    add_index "negatives", ["instructor_id"], name: "index_negatives_on_instructor_id", using: :btree
    add_index "negatives", ["photo_id"], name: "index_negatives_on_photo_id", using: :btree
    add_index "negatives", ["student_id"], name: "index_negatives_on_student_id", using: :btree
    add_index "negatives", ["user_id"], name: "index_negatives_on_user_id", using: :btree
    add_index "negatives", ["wdier_id"], name: "index_negatives_on_wdier_id", using: :btree
  
    create_table "photos", force: :cascade do |t|
      t.string "img_url"
      t.string "caption"
    end
  
    create_table "posts", force: :cascade do |t|
      t.string  "name"
      t.string  "body"
      t.integer "wdier_id"
    end
  
    add_index "posts", ["wdier_id"], name: "index_posts_on_wdier_id", using: :btree
  
    create_table "students", force: :cascade do |t|
      t.string  "name"
      t.string  "img_url"
      t.string  "github_url"
      t.string  "portfolio_url"
      t.string  "project1_url"
      t.string  "project2_url"
      t.string  "project3_url"
      t.string  "project4_url"
      t.string  "quote"
      t.string  "q1"
      t.string  "q2"
      t.string  "q3"
      t.string  "q4"
      t.string  "fb"
      t.string  "linkedin"
      t.string  "email"
      t.string  "password"
      t.integer "instructor_id"
      t.integer "squad_id"
      t.integer "user_id"
      t.integer "wdier_id"
    end
  
    add_index "students", ["instructor_id"], name: "index_students_on_instructor_id", using: :btree
    add_index "students", ["squad_id"], name: "index_students_on_squad_id", using: :btree
    add_index "students", ["user_id"], name: "index_students_on_user_id", using: :btree
    add_index "students", ["wdier_id"], name: "index_students_on_wdier_id", using: :btree
  
    create_table "users", force: :cascade do |t|
      t.string   "email",                  default: "", null: false
      t.string   "encrypted_password",     default: "", null: false
      t.string   "reset_password_token"
      t.datetime "reset_password_sent_at"
      t.datetime "remember_created_at"
      t.integer  "sign_in_count",          default: 0,  null: false
      t.datetime "current_sign_in_at"
      t.datetime "last_sign_in_at"
      t.inet     "current_sign_in_ip"
      t.inet     "last_sign_in_ip"
      t.datetime "created_at",                          null: false
      t.datetime "updated_at",                          null: false
      t.string   "name"
      t.string   "img_url"
      t.string   "github_url"
      t.string   "portfolio_url"
      t.string   "project1_url"
      t.string   "project2_url"
      t.string   "project3_url"
      t.string   "quote"
      t.string   "squad_name"
      t.string   "teaching"
      t.string   "memory"
      t.string   "favlang"
      t.string   "wisewords"
      t.string   "tag_list"
      t.string   "q1"
      t.string   "q2"
      t.string   "q3"
      t.string   "fb"
      t.string   "linkedin"
      t.integer  "squad_id"
      t.integer  "student_id"
      t.integer  "instructor_id"
    end
  
    add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
    add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
  
    create_table "wdiers", force: :cascade do |t|
      t.string  "name"
      t.string  "img_url"
      t.string  "github_url"
      t.string  "portfolio_url"
      t.string  "project1_url"
      t.string  "project2_url"
      t.string  "project3_url"
      t.string  "quote"
      t.string  "squad_name"
      t.integer "teaching"
      t.integer "memory"
      t.integer "favlang"
      t.integer "wisewords"
      t.integer "tag_list"
      t.integer "q1"
      t.integer "q2"
      t.integer "q3"
      t.integer "fb"
      t.integer "linkedin"
      t.integer "email"
      t.integer "role"
      t.integer "password"
      t.integer "squad_id"
      t.integer "codey_id"
      t.integer "student_id"
      t.integer "instructor_id"
    end
  
    add_index "wdiers", ["codey_id"], name: "index_wdiers_on_codey_id", using: :btree
    add_index "wdiers", ["instructor_id"], name: "index_wdiers_on_instructor_id", using: :btree
    add_index "wdiers", ["squad_id"], name: "index_wdiers_on_squad_id", using: :btree
    add_index "wdiers", ["student_id"], name: "index_wdiers_on_student_id", using: :btree
  
    add_foreign_key "comments", "wdiers"
  end
  </code></pre>
  
  <p>Any help would be greatly appreciated!!!</p>
  
  <p>I am adding the rake routes to the question. </p>
  
  <pre><code>$ rake routes
                    Prefix Verb   URI Pattern                                Controller#Action
          new_user_session GET    /users/sign_in(.:format)                   devise/sessions#new
              user_session POST   /users/sign_in(.:format)                   devise/sessions#create
      destroy_user_session DELETE /users/sign_out(.:format)                  devise/sessions#destroy
             user_password POST   /users/password(.:format)                  devise/passwords#create
         new_user_password GET    /users/password/new(.:format)              devise/passwords#new
        edit_user_password GET    /users/password/edit(.:format)             devise/passwords#edit
                           PATCH  /users/password(.:format)                  devise/passwords#update
                           PUT    /users/password(.:format)                  devise/passwords#update
  cancel_user_registration GET    /users/cancel(.:format)                    devise/registrations#cancel
         user_registration POST   /users(.:format)                           devise/registrations#create
     new_user_registration GET    /users/sign_up(.:format)                   devise/registrations#new
    edit_user_registration GET    /users/edit(.:format)                      devise/registrations#edit
                           PATCH  /users(.:format)                           devise/registrations#update
                           PUT    /users(.:format)                           devise/registrations#update
                           DELETE /users(.:format)                           devise/registrations#destroy
                      root GET    /                                          yearbook#index
                       tag GET    /tags/:tag(.:format)                       photo#index
               wdier_posts GET    /wdiers/:wdier_id/posts(.:format)          posts#index
                           POST   /wdiers/:wdier_id/posts(.:format)          posts#create
            new_wdier_post GET    /wdiers/:wdier_id/posts/new(.:format)      posts#new
           edit_wdier_post GET    /wdiers/:wdier_id/posts/:id/edit(.:format) posts#edit
                wdier_post GET    /wdiers/:wdier_id/posts/:id(.:format)      posts#show
                           PATCH  /wdiers/:wdier_id/posts/:id(.:format)      posts#update
                           PUT    /wdiers/:wdier_id/posts/:id(.:format)      posts#update
                           DELETE /wdiers/:wdier_id/posts/:id(.:format)      posts#destroy
                    wdiers GET    /wdiers(.:format)                          wdiers#index
                           POST   /wdiers(.:format)                          wdiers#create
                 new_wdier GET    /wdiers/new(.:format)                      wdiers#new
                edit_wdier GET    /wdiers/:id/edit(.:format)                 wdiers#edit
                     wdier GET    /wdiers/:id(.:format)                      wdiers#show
                           PATCH  /wdiers/:id(.:format)                      wdiers#update
                           PUT    /wdiers/:id(.:format)                      wdiers#update
                           DELETE /wdiers/:id(.:format)                      wdiers#destroy
                    photos GET    /photos(.:format)                          photos#index
                           POST   /photos(.:format)                          photos#create
                 new_photo GET    /photos/new(.:format)                      photos#new
                edit_photo GET    /photos/:id/edit(.:format)                 photos#edit
                     photo GET    /photos/:id(.:format)                      photos#show
                           PATCH  /photos/:id(.:format)                      photos#update
                           PUT    /photos/:id(.:format)                      photos#update
                           DELETE /photos/:id(.:format)                      photos#destroy
                    codeys GET    /codeys(.:format)                          codeys#index
                           POST   /codeys(.:format)                          codeys#create
                 new_codey GET    /codeys/new(.:format)                      codeys#new
                edit_codey GET    /codeys/:id/edit(.:format)                 codeys#edit
                     codey GET    /codeys/:id(.:format)                      codeys#show
                           PATCH  /codeys/:id(.:format)                      codeys#update
                           PUT    /codeys/:id(.:format)                      codeys#update
                           DELETE /codeys/:id(.:format)                      codeys#destroy
                    squads GET    /squads(.:format)                          squads#index
                           POST   /squads(.:format)                          squads#create
                 new_squad GET    /squads/new(.:format)                      squads#new
                edit_squad GET    /squads/:id/edit(.:format)                 squads#edit
                     squad GET    /squads/:id(.:format)                      squads#show
                           PATCH  /squads/:id(.:format)                      squads#update
                           PUT    /squads/:id(.:format)                      squads#update
                           DELETE /squads/:id(.:format)                      squads#destroy
  </code></pre>