Define autofill attributes when creating new supplier from shared_supplier.
This commit is contained in:
parent
e74c6b4068
commit
7c4ee01ff2
2 changed files with 8 additions and 2 deletions
|
|
@ -7,6 +7,12 @@ class SharedSupplier < ActiveRecord::Base
|
|||
|
||||
has_one :supplier
|
||||
has_many :shared_articles, :foreign_key => :supplier_id
|
||||
|
||||
|
||||
# These set of attributes are used to autofill attributes of new supplier,
|
||||
# when created by import from shared supplier feature.
|
||||
def autofill_attributes
|
||||
whitelist = %w(name address phone fax email url delivery_days note)
|
||||
attributes.select { |k,_v| whitelist.include?(k) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue