Topic: Adding new Rows to the DB [SOLVED]

i am trying to add a new row to the db or Create a new record

the error that i am getting is a NoMethodError in AccountsController#create
undefined method `acount' for #<Account:0x007fdf622000a0>

i made a migration to to rename  acount to account

and then i rename acount to account but i am ovisly missing one

where else can or should i check

AccountsController

class AccountsController < ApplicationController

  def index
    @account = Account.all
  end

  def show
    @account = Account.find(params[:id])
  end

  def new
    @account = Account.new
  end

  def create
    @account = Account.new(params[:account])
    if @account.save
      flash[:success] = "Account Created"
      redirect_to @account
    else
      render 'new'
    end
  end

  def edit
    @account = Account.find(params[:id])
  end

  def update
    @account = Account.find(params[:id])
    if @account.update_attributes(params[:account])
      flash[:success] = "Account Updated"
      redirect_to @account
    else
      render 'edit'
    end
  end

  def destroy
    Account.find(params[:id]).destroy
    flash[:success] = "account destroyed."
    redirect_to account_path
  end


end

Last edited by moiseszaragoza (2012-05-31 15:13:45)

Re: Adding new Rows to the DB [SOLVED]

Check controller name, routes and that type of sending request is post.

Re: Adding new Rows to the DB [SOLVED]

Thanks
i was able to find it.
i had the typo on the validation on the view