Including jQuery library

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”

OnlineDictionary <%= stylesheet_link_tag "application" %> <%= javascript_include_tag :defaults %> <%= csrf_meta_tags %>

<%= yield %>

and finally in" test.html.erb"

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

On Sun, Jan 8, 2012 at 1:02 AM, Soichi I. [email protected]
wrote:

If I’m not wrong, in rails 3.x that folder no longer exists

OnlineDictionary <%= 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

On 8 January 2012 06:02, Soichi I. [email protected] 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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs