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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, Jan 8, 2012 at 1:02 AM, Soichi Ishida <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 8 January 2012 06:02, Soichi Ishida <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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.3Find 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.