开发者

Rails route rewriting

I think this is an easy question. I am using this useful Flash Document Reader called FlexPaper. I have it embedded in one of my Show pages. But when I click the a link on their tool bar to show the document in a new browser, it points to the following link:

http://example.com/intels/FlexPaperViewer.swf?ZoomTime=0.5&FitPageOnLoad=false&PrintEnabled=false&SwfF开发者_如何学编程ile=%2FPaper.swf

which doesn't work, I get the following error:

ActiveRecord::RecordNotFound in IntelsController#show

Couldn't find Intel with ID=FlexPaperViewer

but if I remove the "intels" from the path so the url looks like:

http://example.com/FlexPaperViewer.swf?ZoomTime=0.5&FitPageOnLoad=false&PrintEnabled=false&SwfFile=%2FPaper.swf

It works fine.

My question is what is the best way to handle this? Can you write a route that rewrites a url that starts with intels/FlexPaperViewer.swf and remove the intels prefix? What would that look like?

Is there a better option?


Juat a thought, how about placing the FlexPaperViewer.swf inside public/intels folder?

So the directory structure will be

<project-directory>/public/intels/FlexPaperViewer.swf

Doing this will make the link correct. It seems to be easier to do it this way. Hopefully it helps.

EDIT

Another alternative will be to see how the link was generated, maybe there is a parameter that you can set when you embed the FlexPaper.

I am not aware of any route modification that can do what you want. Maybe someone else can help on this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜