Displaying 5 results from an estimated 5 matches for "shippingaddress".
Did you mean:
shipping_address
2009 Jun 24
1
accepts_nested_attributes_for :reject_if issue
...ributes_for :shipping_address, :reject_if => proc {
|attributes| attributes[''has_shipping_address''] != ''1'' }
def after_initialize
self.build_billing_address unless billing_address
self.build_shipping_address unless shipping_address
end
end
class ShippingAddress < OrderAddress
attr_accessor :has_shipping_address
end
class OrderAddress < ActiveRecord::Base
validates_presence_of :name
#more validations here..
end
And the view:
<% form_for @order do |f| %>
#...
<% f.fields_for :shipping_address do |addr_f| %>
<%= addr_f.c...
2010 May 10
7
NilClass passed to partial view
...hem (Company table has a "billingAddress_id" row)
In my views "company/_form"(scaffold generated), I want to display the
address form. So I added (following Rails Guides) the following line to
my view :
<%= render :partial => "addresses/edit", :locals => { :shippingAddress
=> @address} %>
It keeps saying : "undefined method `model_name'' for NilClass:Class "
tried this :
<%= render :partial => "addresses/edit", :locals => {
@company.shippingAddress => @address} %>
with the same result
I''ve tried with :
<%=...
2005 Sep 29
0
Table relationships with single table inheritance
Hi,
How do I relate a table to another when one of the models uses single table
inheritance? Will this even work? This is the specific problem I am having:
There''s an "Address" model with "ShippingAddress" and "BillingAddress" as
subclasses. It looks like this:
class Address < ActiveRecord::Base
End
class ShippingAddress < Address
has_one :order
End
Class BillingAddress < Address
End
On the Order side:
class order < ActiveRecord::Base
belongs_to :ShippingAddress...
2006 Jun 06
1
Please Help with single table inheritance relationships
...igrate file
create_table ''addresses'' do |t|
t.column ''person_id'' :integer
t.column ''type'' :string
..
end
# Generated model from rails'' scaffolding
class Address < ActiveRecord::Base
end
# Manually added these 3 classes
class ShippingAddress < Address
belongs_to :person
end
class BillingAddress < Address
belongs_to :person
end
class ShipFromAddress < Address
belongs_to :retailer
def retailer_id= (input)
person_id = input;
end
def retailer_id
person_id
end
end
# Made these changes:
class Person < Active...
2006 Aug 02
3
Data relationships for e-commerce: users, orders, addresses
Hi there
I''m in the process of developing an e-commerce Rails app but am
getting a little stuck on what models I should be working with on the
order/checkout side of things.
The app requires users to be registered and authenticated to checkout.
So I already have a User model and an Order model (which belongs to a
User). The Order model is largely similar to that used in the Agile
Rails