Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8760041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:57:03+00:00 2026-06-13T14:57:03+00:00

Directly after generating a scaffold I am getting a NoMethodError when trying to create

  • 0

Directly after generating a scaffold I am getting a NoMethodError when trying to create some new test dummy data.

I am new to rails and so I am probably doing something simple wrong but it doesn’t seem like rails should have generated files with errors right from the get go.

Model:

class Character < ActiveRecord::Base
  attr_accessible :cha, :class, :class_option, :con, :dex, :exp, :int, :name, :portrait_url, :str, :wis
end

View:

<h1>Listing characters</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Exp</th>
    <th>Class</th>
    <th>Class option</th>
    <th>Str</th>
    <th>Dex</th>
    <th>Con</th>
    <th>Int</th>
    <th>Wis</th>
    <th>Cha</th>
    <th>Portrait url</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @characters.each do |character| %>
  <tr>
    <td><%= character.name %></td>
    <td><%= character.exp %></td>
    <td><%= character.class %></td>
    <td><%= character.class_option %></td>
    <td><%= character.str %></td>
    <td><%= character.dex %></td>
    <td><%= character.con %></td>
    <td><%= character.int %></td>
    <td><%= character.wis %></td>
    <td><%= character.cha %></td>
    <td><%= character.portrait_url %></td>
    <td><%= link_to 'Show', character %></td>
    <td><%= link_to 'Edit', edit_character_path(character) %></td>
    <td><%= link_to 'Destroy', character, method: :delete, data: { confirm: 'Are you sure?' } %></td>
  </tr>
<% end %>
</table>

<br />

Controller:

class CharactersController < ApplicationController
  # GET /characters
  # GET /characters.json
  def index
    @characters = Character.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @characters }
    end
  end

  # GET /characters/1
  # GET /characters/1.json
  def show
    @character = Character.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @character }
    end
  end

  # GET /characters/new
  # GET /characters/new.json
  def new
    @character = Character.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @character }
    end
  end

  # GET /characters/1/edit
  def edit
    @character = Character.find(params[:id])
  end

  # POST /characters
  # POST /characters.json
  def create
    @character = Character.new(params[:character])

    respond_to do |format|
      if @character.save
        format.html { redirect_to @character, notice: 'Character was successfully created.' }
        format.json { render json: @character, status: :created, location: @character }
      else
        format.html { render action: "new" }
        format.json { render json: @character.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /characters/1
  # PUT /characters/1.json
  def update
    @character = Character.find(params[:id])

    respond_to do |format|
      if @character.update_attributes(params[:character])
        format.html { redirect_to @character, notice: 'Character was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @character.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /characters/1
  # DELETE /characters/1.json
  def destroy
    @character = Character.find(params[:id])
    @character.destroy

    respond_to do |format|
      format.html { redirect_to characters_url }
      format.json { head :no_content }
    end
  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:57:04+00:00Added an answer on June 13, 2026 at 2:57 pm

    You managed to use some reserved words as your attributes. Specifically class should not be used as a model attribute. You’ll notice character.class gets called in your view, which should return ‘Character’, the class name of that specific character object.

    Here’s a list of reserved keywords: http://oldwiki.rubyonrails.org/rails/pages/ReservedWords

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After creating a table (by migration), I want to insert some entries directly. How
i am trying to upload a file directly to amazon s3, however after the
If am am calling boost::asio::async_write/async_read directly after each other, will the data be ordered?
I am trying to get my footer to appear directly after the last div
Possible Duplicate: How can I get a reference to a node directly after it
After asking my first question Windows Phone 7.1 app accessing Azure Storage directly ,
Is it possible to use a session variable, then unset it directly after? Example:
Possible Duplicate: declare property as object? in java you can create an object directly
I'm trying to create a very simple & lightweight client implementation of the SSH
Possible Duplicate: Any way to access array directly after method call? In C# and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.