Displaying 3 results from an estimated 3 matches for "primary_us".
Did you mean:
primary_bus
2007 Jun 13
6
ActiveRecord query using association
...rmation I have found on the web.
This seems like it should be simple, but I haven''t really found an
example of how to do this yet.
I have a model called Account which has a belongs_to reference to
another model, User, as below:
class Account < ActiveRecord::Base
belongs_to :primary_user, :class_name =>
"User", :foreign_key => "primary_user"
end
The User model has a property "last_name" and the Account model has a
property "account_name". I want to create a query to find all
accounts by the account''s name (account.account_n...
2006 Aug 17
2
validates_associated bug?
...redit_card_id
CreditCard
id, etc...
and a business_user_controller to create it all:
def create
@user = User.new(params[:user])
@business_user = BusinessUser.new(params[:business_user])
@business_user.user = @user
@organization = Organization.new(params[:organization])
@organization.primary_user = @business_user
@credit_card = CreditCard.new
credit_card_validated = true
has_credit_card = params[:has_credit_card] == ''true''
if has_credit_card
@credit_card = CreditCard.new(params[:credit_card])
credit_card_validated = @credit_card.save
@organization.cr...
2006 Aug 12
0
issues with relationships and multiple objects on one form
...s. The models are defined as:
class User < ActiveRecord::Base
belongs_to :primary_organization,
:class_name => ''Organization'',
:foreign_key => ''primary_organization_id''
class Organization < ActiveRecord::Base
has_many :primary_users,
:class_name => ''User'',
:foreign_key => ''primary_organization_id''
A select displays all Organizations on the User form, allowing the
relationship to be defined using the code:
<p><label for="user_primary_organizatio...