Forms Collecting data and basic ruby concept

i am not grasping a very basic concept here.

i have 3 models A, B, C

i have a form that is created via controller A but i need to put the
data in model B, C

so all the input fields belong to either B or C

how can i accomplish this so that i can fill the users input if
validation does not succeed.

using a model A to form A i use @input_info = A.new(params[:a]) but of
course this will not work.

can someone lead me the right way.

That's pretty confusing. Could you explain it a little more concretely?

rushnosh wrote:

i am not grasping a very basic concept here.

i have 3 models A, B, C

i have a form that is created via controller A but i need to put the
data in model B, C

ANSWER : NO MATTER, YOU CAN DO IT
EXAMPLE :

class AController < ApplicationController

def create
    @data = B.new(params[:a])

    if @data.save
       flash[:notice] = " Hello A Form, now you are in B"
    end
end

end

so all the input fields belong to either B or C

how can i accomplish this so that i can fill the users input if
validation does not succeed.

For additional attributes that have no existed in table you can use
att_reader :new_attribute_name

and validation you can put in model/ AR:

private

def validate
  if new_attribute_name.nil?
     errors.add ("Hey new attribute", "you cant be blank.")
  end
end

GoodLick :smiley:
Reinhart
http://teapoci.blogspot.com

Look into the fields_for helper. It allows you to specify fields for a
different model within a form_for block.

I'd also suggest looking at railscasts.com, where there's several
screencasts on creating complex forms.

Michael Slater
www.BuildingWebApps.com (Rails developer portal)
www.LearningRails.com (screencasts)