私はそのようなRoRビューを持っています(haml上):
-if @articles.blank?
%h3
Увы, нет артикулов в данной категории
-else
- @constr_num.each do |cc|
= cc.ARL_SEARCH_NUMBER
%table.zebra
%tr
%th Производитель
%th Наименование/описание
%th
%th Цена
%th Кол-во на складе
%th Сроки поставки
%th
-if @non_original.present?
%br
- if @non_original.is_a?(Array)
=@non_original.each do |no|
%tr{ :class => cycle("zebra-stripe zebra-green zebra1", "zebra-stripe zebra-green zebra2")}
%td
%h4
=no.brand
%td
%h4
-if user_signed_in?
= no.article_nr
-else
= no.article_nr.first.concat("***").concat(no.article_nr.last)
=no.description
%td
= #link_to "подробнее/аналоги", "#"
%td
=no.price
%td
=no.quantity.gsub(/[^0-9]/, '').to_i
%td
=no.waittime
%td
-if no.quantity.present? && no.quantity.gsub(/[^0-9]/, '').to_i > 0
= #button_to 'В корзину', line_items_path(ART_ID: no), :remote => false, :class => "to-cart"
= #button_to 'В корзину2', line_items_path(ART: no.brand+" | "+no.article_nr+" | "+no.description, price: 11, distributor_id: no.distributor_id), :remote => false, :class => "to-cart"
= form_tag(line_items_path) do |f|
= hidden_field_tag 'ART', no.brand+" | "+no.article_nr+" | "+no.description
= #text_field_tag 'price', 11
= hidden_field_tag 'price', no.price
= hidden_field_tag 'distributor_id', no.distributor_id
= submit_tag "Upload", :class => "to-cart"
%br
- @articles.each do |art|
%tr{ :class => cycle("zebra-stripe zebra-grey zebra1", "zebra-stripe zebra-grey zebra2")}
%td
%h4
= art.supplier.SUP_BRAND
=# art.ART_ID
%td
= art.art_name
%h4
-if user_signed_in?
= art.ART_ARTICLE_NR
-else
= art.ART_ARTICLE_NR.first.concat("***").concat(art.ART_ARTICLE_NR.last)
%td
= link_to "подробнее/аналоги", art
%td
-if art.Quantity.present? && art.Quantity > 0
= #((art.Price.to_f - art.Price.to_f * @discont) * @eur_cur.currency_value).round(-1)
%h4
= #art.find_price(art.ART_ARTICLE_NR.gsub(/[^0-9A-Za-z]/, ''), art.supplier.SUP_BRAND, "price")
%p{ :nr => art.ART_ARTICLE_NR.gsub(/[^0-9A-Za-z]/, ''), :br => art.supplier.SUP_BRAND, :type => "price", :class => "priceclass", :id => art.ART_ARTICLE_NR.gsub(/[^0-9A-Za-z]/, '')}
%td
%p{ :nr => art.ART_ARTICLE_NR.gsub(/[^0-9A-Za-z]/, ''), :br => art.supplier.SUP_BRAND, :type => "quantity", :class => "qntclass", :id => art.ART_ARTICLE_NR.gsub(/[^0-9A-Za-z]/, '').concat("q")}
.logo
%td
%p{ :nr => art.ART_ARTICLE_NR.gsub(/[^0-9A-Za-z]/, ''), :br => art.supplier.SUP_BRAND, :type => "waittime", :class => "waittimeclass", :id => art.ART_ARTICLE_NR.gsub(/[^0-9A-Za-z]/, '').concat("w")}
%td
-if art.Quantity.present? && art.Quantity > 0
= #button_to 'В корзину', line_items_path(ART: art.supplier.SUP_BRAND+" | "+art.ART_ARTICLE_NR+" | "+art.art_name, price: 11), :remote => false, :class => "to-cart"
= form_tag(line_items_path) do |f|
= hidden_field_tag 'ART', art.supplier.SUP_BRAND+" | "+art.ART_ARTICLE_NR+" | "+art.art_name
= #text_field_tag 'price', 11
= hidden_field_tag 'price', 0, :id => art.ART_ARTICLE_NR.gsub(/[^0-9A-Za-z]/, '')
= hidden_field_tag 'distributor_id', 1
= submit_tag "Upload", :class => "to-cart"
- if @oem_art.is_a?(Array)
=@oem_art.each do |oem|
%tr{ :class => cycle("zebra-stripe zebra-blue zebra1", "zebra-stripe zebra-blue zebra2")}
%td
%h4
=#oem[oem][:car]
.pagination_content
= paginate @articles
%h4
Не нашли необходимую запчасть?
= link_to "Сделать on-line запрос менеджеру", new_ask_vin_path
通常のテーブルを見ないといけないと思いますが、最初の=@non_original.each do |no|
ように取得します
[#<PriceList id: 77845, distributor_id: 1, brand: "TECH-AS", article_nr: "110064Q", price: 3.0, quantity: ">8", waittime: 1, description: "110064Q (TO1341D) OX143D 1100696 AUDI/VW TDI", created_at: "2012-10-11 21:21:56", updated_at: "2012-10-11 21:21:56">, #<PriceList id: 7253, distributor_id: 1, brand: "CARGO", article_nr: "B140036", price: 0.0, quantity: "0", waittime: 1, description: "140036A 3471553 Del 12.08x14.08x14.00", created_at: "2012-10-11 09:36:26", updated_at: "2012-10-11 09:36:26">]
しかし、このデータが表に表示されます...これは魔法です)このデータを表にのみ表示するにはどうすればよいですか?
スクリーンショットを参照してください:
また、私のコントローラーは次のようになります。
def get_parts_via_category
*****(secret))))
@articles = Kaminari.paginate_array(@pre_articles).page(params[:page]).per(20)
@asdasd = ArtLookup.get_construction_number(@pre_articles.map(&:ART_ID))
@constr_num = @asdasd.uniq{|x| x.ARL_SEARCH_NUMBER}
logger.warn("mE gusta !!!!!!")
non_original = []
@pre_articles.each do |a|
logger.warn("SDFSDFS fsdf sdf sdfSDF SDF SD !!!!!!!!!!! dgfdfg d*fd*g fd-gd f")
a.logger.warn(a.supplier.SUP_BRAND.gsub(/[^0-9A-Za-z]/, ''))
norig = get_non_tecdoc(a.ART_ARTICLE_NR.to_s.gsub(/[^0-9A-Za-z]/, ''), 1, a.supplier.SUP_BRAND)
if norig.present?
non_original << norig
end
end
oem_art = []
@constr_num.each do |o|
as_oem = get_from_as_oem(o.ARL_SEARCH_NUMBER)
if as_oem.present?
oem_art << as_oem
end
end
@non_original = non_original.uniq
@oem_art = oem_art.to_a.uniq
@eur_cur = Currency.find_by_currency_name("EUR")
@discont = 0
if user_signed_in?
@discont = 0.01
user = User.find(current_user.id)
@total = 0
for order in user.orders do
@total += order.totalcost
if @total >=0 && @total <= 1000000
@discont = 0.02
end
if @total >=1000000 && @total < 7000000
@discont = 0.1
end
if @total >=7000000 && @total < 10000000
@discont = 0.15
end
if @total >=10000000
@discont = 0.2
end
end
end
end