2011-09-16 9 views
0

私はto_xlsの宝石を使用しています。アクティブレコードからxlsファイルを生成するのは素晴らしいことです。しかし何らかの理由で私はヘッダーを表示することができません。ヘッダがto_xlsを使用して表示されない

enter image description here

ここでコントローラです:それは属性名を理解することはできませんので

format.xls { 
    send_data @tickets.to_xls(
     :columns => [:created_at, :title, {:category => :title}, {:group => :name}, {:location => :name}, :starts, :target, {:requestor => :full_name}, :percent_complete, :recurring, :cost, :spent, :task_level], 
     :headers => [:created, :name, :category, :group, :location, :start_date, :target_date, :requestor, :percent_complete, :recurring, :cost, :spent, :task_level] 
    ) 
    } 
+0

(:ヘッダ=> false)をどこでしょうか? – ahmet

+0

nope。ちょうどあなたがそこに見るもの。 – Marc

+0

私が考えることができる他の可能なものは、正しい量ではありません:ヘッダー:列:S私にはうまく見えます – ahmet

答えて

0

to_xlsプラグインは、関連するモデルとの見出しを表示しません。

あなたは代わりに、属性のヘッダに文字列を与えることを試みることができます:あなたが持って起こりません

format.xls { 
    send_data @tickets.to_xls(
     :columns => [:created_at, :title, {:category => :title}, {:group => :name}, {:location => :name}, :starts, :target, {:requestor => :full_name}, :percent_complete, :recurring, :cost, :spent, :task_level], 
     :headers => ["created", "name", "category", "group", "location", "start_date", "target_date", "requestor", "percent_complete", "recurring", "cost", "spent", "task_level"] 
    ) 
} 
+0

私は実際に宝石の作成者に連絡を取り、欠陥であると言いました。それは今修正され、私の質問でそれを持っていた方法で働いています。ありがとう!あなたの情報をお寄せいただきありがとうございます。 – Marc

+0

私は私のプロジェクトを更新することができます:) – xaph

関連する問題