Source a javascript and stylesheet into rhtml file

T

Tim Trampedach

Hi all,

I'm trying to do a quick dump of a javascript and style sheet located in
their respective /public directories into an rhtml file. I want to
include the entire text of the file in my rhtml file. How do I do this
quickly and efficiently? In PHP there's readfile, but I can't figure out
an equivalent call in ruby.

Thanks so much in advance!

Tim
 
P

Phlip

Tim Trampedach wrote in message ne\
I'm trying to do a quick dump of a javascript and style sheet located in
their respective /public directories into an rhtml file.

<%=h File.read(RAILS_ROOT + '/public/javascript/my_source.js') %>

This is half introductory Ruby and half introductory Rails, so one might
consider reading a little of the excellent books on these subjects, offline,
for a while!
 
J

James Britt

Phlip said:
Tim Trampedach wrote in message ne\


<%=h File.read(RAILS_ROOT + '/public/javascript/my_source.js') %>

This is half introductory Ruby and half introductory Rails, so one might
consider reading a little of the excellent books on these subjects,
offline, for a while!



Rails questions are better directed to Rails mailing list, where you'll
get better, faster, information.
 
G

Gregory Seidman

Rails questions are better directed to Rails mailing list, where you'll get
better, faster, information.

While Philip may have assumed that Tim was using Rails, there was nothing
in the original post to indicate that Rails is involved. It's just ERB to
produce HTML (in this case with embedded JS and CSS), which comes up in
other contexts.
James Britt
--Greg
 
J

James Britt

Gregory said:
While Philip may have assumed that Tim was using Rails, there was nothing
in the original post to indicate that Rails is involved. It's just ERB to
produce HTML (in this case with embedded JS and CSS), which comes up in
other contexts.


Amazingly true.

My reply was to suggest a better place for Rails help if this was in
fact part of a Rails matter.


--
James Britt

"I have the uncomfortable feeling that others are making a religion
out of it, as if the conceptual problems of programming could be
solved by a single trick, by a simple form of coding discipline!"
- Edsger Dijkstra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top