Just updated files in any format won't pass file_type_check

5 views
Skip to first unread message

Railsmaniac

unread,
Sep 10, 2009, 4:44:15 AM9/10/09
to ruby-roo
Hi!

file_type_check has it's logic based on compariation of file extension
with accepted extensions list. But if the file is a request parameter
and has just been updated, it's extension will be kind of ".0" or
something.

I want to ignore the error raised and proceed with the file. As i can
see, it's possible using @file_warning = :ignore.

Where is the right place to set @file_warning? It sounds like there
should be a config or something, maybe rails initializers are ok? Is
there any way to pass any kind of configuration including that option
into Roo ?

If not, i could provide the code to do that, but covering only config
options i will need.

Thank you!

Thomas Preymesser

unread,
Sep 10, 2009, 5:32:07 AM9/10/09
to ruby-roo
Hello,

On Sep 10, 10:44 am, Railsmaniac <gad....@gmail.com> wrote:
> Where is the right place to set @file_warning? It sounds like there
> should be a config or somethin

if you set the third parameter in the .new call to :ignore, the file
extension will be ignored.
This means that you are responsible that the spreadsheet is of the
correct type.

myspreadsheet = Excel.new(File.join(TESTDIR,"numbers1.ods"),
false, :ignore)

-Thomas

Reply all
Reply to author
Forward
0 new messages