serving html pages with <script> tags pointing at my .js files

Im building a web app based on a web design consisting of .html and .js files created by our web designer.

The html files that I received have <script> tags pointing at the .js files, which should all be for layout/design stuff.

When I try to serve these files through rails, I get CSRF errors.

Looking at the docs for the "protect_from_forgery" method
   (http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html )
I get the impression that the only way to get this to work (serve the .js files from rails) is to turn off the CSRF protection for these javascript files.
Am I reading that correctly?

Also, I'm willing to believe that I'm generally "Doing It Wrong" here -- I started a thread here yesterday looking for general information on how to serve files provided by our web designer, while not knowing javascript or CSS.

I would strongly recommend converting all the html files to erb and
incorporating the js (and css) files into the standard asset pipeline.

Besides fixing this immediate problem, you'll be able to convert all
the layout components (header/footer, menus, etc.) to partials which
will make maintenance a lot easier.

And if possible set your designer up to be able to run the app and
use git so s/he can make any adjustments directly. (From experience
I realize that's not always feasible, but worth a try...)

Good luck,

This sounds awfully like it'll require me to know javascript and CSS.

I'll take a look at the asset pipeline guide and see what I get when I
filter out the "how to create js and css files with rails"-type advice.

Besides fixing this immediate problem, you'll be able to convert all
the layout components (header/footer, menus, etc.) to partials which
will make maintenance a lot easier.

This sounds awfully like it'll require me to know javascript and CSS.

? Not at all. Dividing a "page" into logical components and including
them as partials has nothing to do with either.

Though it's hard for me to imagine doing "web development" at any
level in 2014 without knowing at least the basics of JS and CSS :slight_smile:

I'll take a look at the asset pipeline guide and see what I get when I
filter out the "how to create js and css files with rails"-type advice.

Putting the CSS files into the directory where the asset pipeline will
find them shouldn't be all that difficult :slight_smile:

Good luck,