auto_actions_for through many to many link

26 views
Skip to first unread message

Bob Sleys

unread,
May 18, 2011, 1:55:27 PM5/18/11
to hobo...@googlegroups.com
I don't know what I'm doing wrong here.  Have a many to many link setup per below.  I believe I it setup correctly.  I want to have the form to create a new material on the spaces page via the auto_actions_for command in the materials controller.  The form isn't showing up but the route is added.  If I manually navigate to the route (http://localhost:3000/spaces/4-grade-k6-classroom/materials/new) I get the following error.
No reverse reflection for Material.space
app/views/taglibs/auto/rapid/forms.dryml:64:in `block in form__for_material'
app/views/taglibs/auto/rapid/forms.dryml:63:in `form__for_material'
app/views/taglibs/auto/rapid/pages.dryml:889:in `block (6 levels) in new_for_space_page__for_material'
app/views/taglibs/auto/rapid/pages.dryml:888:in `block (5 levels) in new_for_space_page__for_material'
app/views/taglibs/auto/rapid/pages.dryml:888:in `block (4 levels) in new_for_space_page__for_material'
app/views/taglibs/auto/rapid/pages.dryml:873:in `block (3 levels) in new_for_space_page__for_material'
app/views/taglibs/themes/clean/clean.dryml:2:in `block in page_with_aaa82d3a9ca5'
app/views/taglibs/themes/clean/clean.dryml:1:in `page_with_aaa82d3a9ca5'
app/views/taglibs/application.dryml:14:in `block in page_with_a77e028717a9'
app/views/taglibs/application.dryml:13:in `page_with_a77e028717a9'
app/views/taglibs/auto/rapid/pages.dryml:870:in `block in new_for_space_page__for_material'
app/views/taglibs/auto/rapid/pages.dryml:869:in `new_for_space_page__for_material'
app/views/taglibs/auto/rapid/pages.dryml:873:in `block in new_for_space_page'
app/views/taglibs/auto/rapid/pages.dryml:870:in `new_for_space_page'

Code:

class Material < ActiveRecord::Base
  hobo_model # Don't put anything above this
  fields do
    name :string
    quantity :float
    timestamps
  end
  has_many :spaces, :through => :material_spaces, :accessible => :true
  has_many :material_spaces, :dependent => :destroy
  ....
end

class Space < ActiveRecord::Base
  hobo_model # Don't put anything above this
  fields do
    name :string
    space_dwgid :string, :required, :index => true
    description :text
    dwg_x :float
    dwg_y :float
    timestamps
  end
  belongs_to :floor
  has_many :materials, :through => :material_spaces, :accessible => :true
  has_many :material_spaces, :dependent => :destroy
  children :materials
  ...
end

class MaterialSpace < ActiveRecord::Base
  hobo_model # Don't put anything above this
  fields do
    timestamps
  end
  belongs_to :material
  belongs_to :space
  ...
end

class MaterialsController < ApplicationController
  hobo_model_controller
  auto_actions :all
  auto_actions_for :spaces, :create
end

ylluminate

unread,
Jun 26, 2011, 4:27:31 PM6/26/11
to Hobo Users
*bump* Perhaps we can get some additional eyes on this again since
it's still an outstanding issue for you.

kevinpfromnm

unread,
Jun 27, 2011, 12:23:21 PM6/27/11
to hobo...@googlegroups.com
sometimes compound words can give the ruby language parser difficulties in determining the appropriate singular form.  you should be able to check if it's the association easier by jumping in the console and trying to access the different associations from each of the end models.  i.e. Material.new.material_spaces
Reply all
Reply to author
Forward
0 new messages