Refactored shared article import. Added meta search gem.
This commit is contained in:
parent
1e33411516
commit
013637a4fc
8 changed files with 42 additions and 54 deletions
|
|
@ -23,11 +23,28 @@
|
|||
#
|
||||
|
||||
class SharedArticle < ActiveRecord::Base
|
||||
|
||||
|
||||
# connect to database from sharedLists-Application
|
||||
SharedArticle.establish_connection(Foodsoft.config[:shared_lists])
|
||||
# set correct table_name in external DB
|
||||
set_table_name :articles
|
||||
|
||||
|
||||
belongs_to :shared_supplier, :foreign_key => :supplier_id
|
||||
|
||||
def build_new_article
|
||||
shared_supplier.supplier.articles.build(
|
||||
:name => name,
|
||||
:unit => unit,
|
||||
:note => note,
|
||||
:manufacturer => manufacturer,
|
||||
:origin => origin,
|
||||
:price => price,
|
||||
:tax => tax,
|
||||
:deposit => deposit,
|
||||
:unit_quantity => unit_quantity,
|
||||
:order_number => number,
|
||||
# convert to db-compatible-string
|
||||
:shared_updated_on => updated_on.to_formatted_s(:db)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue