Ruby on Rails Wednesday, August 29, 2012

On 30.08.2012 00:44, Axel Aguilar wrote:
> Hello, I have a rails project with one controller and one action, as
> simple as posible. And I'm trying to put some custom css and js to my
> own index.html.erb (not public/index.html.erb), I inluded this on the
> layout file:
>
> layout file:
>
> <!DOCTYPE html>
> <html>
> <head>
> <title>Volei</title>
> <%= stylesheet_link_tag "application", :media => "all" %>
> <%= javascript_include_tag 'foundation.min.js' %>
> <%= javascript_include_tag 'app.js' %>
> <%= javascript_include_tag 'jquery.foundation.navigation.js' %>
> <%= javascript_include_tag 'modernizr.foundation.js' %>
> <%= javascript_include_tag 'mijs.js' %>
> <%= csrf_meta_tags %>
>
> </head>
> <body>
>
> <%= yield %>
>
> </body>
> </html>
>
>
>
> My scripts are in assets/javascripts. And the css works fine, but the js
> not.
>
> I google how to add js and css in rails, and I think I am doing it
> right.. any advice please??
>
> thanks in advance!
>
To make it simplier include just application:
javascript_include_tag 'application'

In application file should be writed something like:
require self
require_tree .

This will require all css files in the assets/javascript folder.

And once more - you have no need to write '.js' for file in Rails at all.

--
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 https://groups.google.com/groups/opt_out.

No comments:

Post a Comment