Forum: Ruby on Rails Select box problems

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Paul O. (Guest)
on 2006-01-21 15:40
Hi all,

I am trying to get a select box to choose the type of goal records to
display using the scope field. I keep getting a " NoMethodError in
Admin#list" on line 8 "undefined method `scope' for

The code from list.rhtml is

<%= start_form_tag :action => 'list' %>
<p>View goals by scope:
options = [["Select the Goal's Scope", ""]] + Goal::GOAL_SCOPES
<%= select("goal", "scope", options) %>
  <%= submit_tag 'Go' %>
<%= end_form_tag %>

and the list method is

  def list
    log =
    log.level = Logger::DEBUG

    @goal = params[:goal]
    if @goal != nil

       #@goals = Goal.find(1)
       @goals = Goal.find(:all, :conditions => ["scope = :scope",
      @goal_pages, @goals = paginate :goals, :per_page => 10

The goal.rb is:

class Goal < ActiveRecord::Base
  validates_presence_of :goal
  validates_uniqueness_of :goal
  acts_as_tree :order => "goal"

  GOAL_SCOPES = [["Lifetime", "Lifetime"], ["This Year", "This Year"],
["This Quarter", "This Quarter"], ["This Month", "This Month"], ["This
Week", "This Week"]].freeze


It seems that this is just a simple problem, but I am very new to rails,
any help is much appreciated


This topic is locked and can not be replied to.