Project

General

Profile

ArgumentError (Object is not missing constant StatusStep!): ???

Added by Pok Lau over 12 years ago

I am developing a plugin, adding some steps for IssueStatus that are specific for Project, but I can't seem to get the controller to load the model properly

Getting this error:

ArgumentError (Object is not missing constant StatusStep!):
  vendor/plugins/redmine_status_step/app/controllers/status_step_controller.rb:14:in `index'
  vendor/plugins/redmine_status_step/app/controllers/status_step_controller.rb:10:in `each'
  vendor/plugins/redmine_status_step/app/controllers/status_step_controller.rb:10:in `index'
  vendor/plugins/redmine_status_step/app/controllers/status_step_controller.rb:6:in `index'

Controller:

class StatusStepController < ApplicationController
  before_filter :find_project, :only => [:new, :index]
  before_filter :find_project, :only => [:new]
  before_filter :find_step, :only => [:edit, :update]
  def index
    respond_to do |format|
      format.html {
        statuses = IssueStatus.find(:all, :conditions => "name like 'Rel_%'", :order => "position")
        @steps_in_statuses = []
        statuses.each do |status|
          steps_in_status = {}
          steps_in_status[:project] = @project
          steps_in_status[:status] = status
          steps_in_status[:steps] = StatusStep.find(:all, :conditions => "status_id = #{status.id} and project_id = #{@project.id}", :order => "position")
          @steps_in_statuses << steps_in_status
        end
      }
    end
  end

Model:

class StatusStep < ActiveRecord::Base
  unloadable
  belongs_to :issue_status, :project

  def status
    IssueStatus.find(status_id)
  end

  def project
    Project.find(project_id)
  end

  def <=>(step)
    position <=> step.position
  end

end

Data definition

class CreateStatusSteps < ActiveRecord::Migration
  def self.up
    create_table :status_steps do |t|
      t.column :status_id, :integer, :default => 0, :null => false
      t.column :project_id, :integer, :default => 0, :null => false
      t.column :position, :integer, :default => 1
      t.column :description, :text
    end
    add_index :status_steps, [:status_id], :name => 'status_steps_status_id'
    add_index :status_steps, [:project_id], :name => 'status_steps_project_id'
  end

  def self.down
    drop_table :status_steps
  end
end

What have I missed?