I apologize for any incorrect/simplified verbiage I use; I'm a total
Rails/Ruby novice. I also apologize if I've posted in the wrong
I currently have a functioning Rails-based project management
application up and running for my graphics company. The site simply
manages all the various data that's applicable to each individual job
that goes through the company. Each job has a simple 9 character
"number" associated to it (i.e., 2010-1234). Each job also has a PDF
file with a partially systematic naming format. I say "partially"
because the first 9 characters of the PDF utilize our job number and
then everything that comes after is contingent upon the client we did
the work for; some clients use job numbers, some use job names, and
others use both. So our PDF file might look like one of the following:
2010-1234 (Warner Center) SD9283B.pdf
Moreover, we've used different PDF naming conventions over the years,
but we've always used the 9 character format that comes at the front of
the PDF file name.
So here is what I want to do: Create a simple link to the applicable PDF
from the record editor/show. So if I'm viewing, for example,
job/record 2010-1234 I'll have a rails-generated-link to it's respective
PDF. The problem is that I need a link that looks something like =>
So the question is, how do I fill in that *wildcard* file-name data?
Maybe this is something I need to do outside of ruby/rails? The only
solution I can think of is using Ruby to somehow grab the file name,
store it, and then utilize it to generate the link. I can't say I know
how to do that but I'm sure I could learn--I just need to know where to
And, yes, I could batch rename every file to remove everything after the
first 9 characters, but at some point I'd like the application to send
the PDFs off as e-mails and our clients need their job titles intact.