search for: workerscontroller

Displaying 1 result from an estimated 1 matches for "workerscontroller".

Did you mean: orderscontroller
2006 Jan 09
0
Saving or updating multiple models
...erson belongs_to :user validates_presence_of :person_id end class Person < ActiveRecord::Base has_many :workers end class Client < ActiveRecord::Base has_many :workers end class User < ActiveRecord::Base # several validations end and the following controller_code: class WorkersController < ApplicationController def create @worker = Worker.new(params[:worker]) @worker.person = Person.new(params[:person]) @worker.user = User.new(params[:user]) if @worker.is_contact if @worker.save # success else # failure end end en...