I'm running rails 4.2.4 and active_scaffold 3.4.29.   If I use 
active_scaffold to create a new object that is associated with a parent. 
 (e.g., Manufacturer and their Products) I cannot associate a new child 
with an existing parent when I create the child.   I must first create a 
Product, then edit it separately to associate it with a Manufacturer.  From 
the github docs it appears that nesting support is enabled by default if 
both directions of the association are defined in the models and for the 
most part it appears to be working.   Apologies in advance if I've missed a 
step, but I'd appreciate your help sorting out why this won't work for me. 

# config/routes.rb
Rails.application.routes.draw do
  resources :manufacturers do as_routes end
  resources :products do as_routes end


# app/models/product.rb
class Product < ActiveRecord::Base
  belongs_to :manufacturer
end


# app/models/manufacturer.rb
class Manufacturer < ActiveRecord::Base
  has_many :products
end


# app/controllers/products_controller.rb
class ProductsController < ApplicationController
  active_scaffold :"product" do |conf|
  end
end


# app/controllers/manufacturers_controller.rb
class ManufacturersController < ApplicationController
  active_scaffold :"manufacturer" do |conf|
  end
end


The existing Manufacturers populate the HTML select drop down, but I have 
not found a way to set the Manufacturer parent.   Merely selecting the 
associated parent in the drop down leaves the relationship empty when I 
commit with the `Create` button.   If I click the `Replace Existing` link 
after selecting a Manufacturer an empty new Product is added without me 
using the `Create` button.   It's empty even if I've already populated Name 
and Part Number.   After clicking the link the manufacturer name and 
abbreviation fields are left empty and when I do hit create, the associate 
is still empty.  

<https://lh3.googleusercontent.com/-44RMGKtdplw/ViXNK27yWxI/AAAAAAAAKlo/8P6WG7cO0GE/s1600/failing_to_associate.png>


Is it a hint that the `Replace With New` and `Replace Existing` font 
appears unformatted?

Thanks much,
Rob

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to