Hi guys,

I am a newbie in developing in Ruby on Rails.
I don't understand how to include the a javascript file.
so like i.e. in general HTML I use this
<script type="text/javascript" src="js/xxx.js"></script>
it seems like I couldn't do this directly, so I need to put the
javascript file in the script folder.
so how do direct to the file?
also, how about a href and img src?

Thanks in Advance,
Richard

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Richard Lung at Oct 5, 2011 at 9:25 pm
    Hi guys,

    I am a newbie in developing in Ruby on Rails.
    I don't understand how to include the a javascript file.
    so like i.e. in general HTML I use this
    <script type="text/javascript" src="js/xxx.js"></script>
    it seems like I couldn't do this directly, so I need to put the
    javascript file in the script folder.
    so how do direct to the file?
    also, how about a href and img src?

    Thanks in Advance,
    Richard

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Oct 6, 2011 at 8:46 am

    On 4 October 2011 10:09, Richard Lung wrote:
    Hi guys,

    I am a newbie in developing in Ruby on Rails.
    I don't understand how to include the a javascript file.
    so like i.e. in general HTML I use this
    <script type="text/javascript" src="js/xxx.js"></script>
    You can certainly do it that way if you want to (after all, by the
    time it gets to the browser it is just html so anything you could do
    without rails you can do with rails). What error did you get when you
    tried it? As you have coded it the file would be expected in
    public/js. More conventionally they would go in public/javascripts
    but that is up to you.

    More conventionally in rails you would use javascript_include_tag to
    include them, it saves typing and avoids having to remember the html
    format.
    it seems like I couldn't do this directly, so I need to put the
    javascript file in the script folder.
    so how do direct to the file?
    also, how about a href and img src?
    Look at link_to and image_tag

    Perhaps also work through some tutorials that will introduce you to
    all these things. railstutorial.org is good and is free to use
    online. Make sure that any tutorial you use matches the rails version
    you are using (the first two digits anyway, eg 3.0)

    Colin

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 5, '11 at 9:25p
activeOct 6, '11 at 8:46a
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Richard Lung: 2 posts Colin Law: 1 post

People

Translate

site design / logo © 2021 Grokbase