Hi. I have started Rails a few days ago.
With the help of a book (written in Japanese), I'm working on a tutorial
program which simply shows how to include jQuery file.

Rails version 3.1.3

According to the book, there must be a directory

public/javascript

but there isn't after launching a new project. But I finally found the
directory

app/assets/javascript

so I copied jquery.js and rails.js in there.

and in "application.rb"

config.action_view.javascript_expansions[:defaults] = %w(jquery
rails)

and in "application.html.erb"

<!DOCTYPE html>
<html>
<head>
<title>OnlineDictionary</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tags %>
</head>
<body>

<%= yield %>
</body>
</html>

and finally in" test.html.erb"

<img id="logo" src="http://www.wings.msn.to/image/wings.jpg" />
<script type="text/javascript">
$('#logo').fadeOut(3000);
</script>

so if success, it should fade out the image. It shows the image but it
does not fade out. It does not work at
all.

Could anyone point out the mistake(s) I presumably made?

soichi

--
Posted via http://www.ruby-forum.com/.

--
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

  • Javier Quarite at Jan 8, 2012 at 6:08 am

    On Sun, Jan 8, 2012 at 1:02 AM, Soichi Ishida wrote:

    Hi. I have started Rails a few days ago.
    With the help of a book (written in Japanese), I'm working on a tutorial
    program which simply shows how to include jQuery file.

    Rails version 3.1.3

    According to the book, there must be a directory

    public/javascript
    If I'm not wrong, in rails 3.x that folder no longer exists

    and in "application.rb"

    config.action_view.javascript_expansions[:defaults] = %w(jquery
    rails)

    and in "application.html.erb"

    <!DOCTYPE html>
    <html>
    <head>
    <title>OnlineDictionary</title>
    <%= stylesheet_link_tag "application" %>
    <%= javascript_include_tag :defaults %>
    Normally I use <%= javascript_include_tag "application"%> because it will
    get all the js that comes from the folder assets.

    Now my question is... what version of rails that book is using?



    Javier

    --
    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 Jan 8, 2012 at 12:03 pm

    On 8 January 2012 06:02, Soichi Ishida wrote:
    Hi. I have started Rails a few days ago.
    With the help of a book (written in Japanese), I'm working on a tutorial
    program which simply shows how to include jQuery file.

    Rails version 3.1.3
    Find a tutorial that matches the version of rails that you are using,
    otherwise you will never know whether troubles you encounter are due
    to real problems or that the tutorial is incorrect for your version of
    rails. railstutorial.org is good and free to use online.

    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.
  • Soichi Ishida at Jan 9, 2012 at 2:24 am
    Thanks everyone.

    The book is using Rails 3.0.5.

    And I changed to

    <%= javascript_include_tag "application"%>

    then the finally generated page seems to includes the jquery.js as I
    wished.
    But it does not fade out...it seems weird.

    I will check the tutorial page you suggested. Thanks.

    soichi

    --
    Posted via http://www.ruby-forum.com/.

    --
    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
postedJan 8, '12 at 6:03a
activeJan 9, '12 at 2:24a
posts4
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase