hi
as far as i know (i’m new on ror) the file structure of javascript files
are:
app/views/posts/…
public/javascripts/*.js
what i understand as a View is final step of the application, the thing
that user see, let’s say…the screen. in this sense, javascript in
some cases, are also -part of- the “view” for some situations.
so, i understand that public/javascript is for general JS code purposes,
but in my case i need to build special JS files for every controller.
even more, in some cases, i need to build JS files for every action
file.
in order to mantain the things on its place, i began to build this
structure:
app/views/posts/edit.html.erb
app/views/posts/new.html.erb
public/javascripts/posts/edit.js
public/javascripts/posts/new.js
even when it works, i must say that i find a little disorder. cuz, as i
said before, this JS code is more ralated to the “view”. so, i really
think that this will be a better structure:
app/views/posts/edit.html.erb
app/views/posts/new.html.erb
app/views/posts/edit.js
app/views/posts/new.js
¿is there an easy a way to make this structure?
¿how and where i must include these js files?
¿wich is the best rails practice for such a thing?
thanks…