I use the following: Rails 3.0.3 Vhochstein Fork for Activescaffold rake 0.9.0 ruby 1.9.2
I have a model called a component that relates to belonging to a category. This was modeled using activescaffold and worked reasonably well. I took a break for a couple of months, and now that I’ve returned to it, activescafold gives an “ActionController :: RoutingError (undefined method` class_name 'for nil: NilClass):" whenever I try to access the component model. I realized that this is due to the relation (belongs to_to). If I delete the relationship with the model, it will work. If I add it back, it won’t work!
Any ideas?
Here is the code:
Routes
namespace :admin do resources :users,:roles,:vendors,:shipping_modes,:order_types,:sizes, :suppliers,:categories,:sub_categories, :material_types,:colours, :materials,:styles,:surcharges, :budget_templates, :budget_components do as_routes end
end
controller
class Admin::BudgetComponentsController < ApplicationController layout 'site_admin' active_scaffold :budget_component do |config| config.actions.exclude :delete,:update config.columns[:category].form_ui = :select config.create.columns = [:name,:category] config.list.columns = [:name,:category] config.show.columns = [:name,:category] config.show.columns.add_subgroup "Time Details" do |name_group| name_group.add :created_at,:updated_at end config.list.sorting = {:name => 'ASC'} end end
Model
class BudgetComponent < ActiveRecord::Base belongs_to :category validates_presence_of :name, :category_id validates_uniqueness_of :name end
source share