On Tuesday, June 26, 2012 11:14:14 PM UTC-4, Vell wrote:
>
> Hello all,
>
> I seem to be running into an issue where jquery seems to be working fine
> in my development environment but when I load it to my production
> environment it does not work. There are some menus that I am trying to hide
> when the web page loads but when they page loads they are there in plain
> site. When I launch firebug and run the same code in console it works
> without any issue so I have wonder if there is a different way I need to
> precompile the assets to get everything to load?
>
> UPDATE: interestingly enough I ran `rake assets:precompile` and I didn't
get any errors prior to submitting this topic. I decided to run rake
`assets:precompile:all` and I hit an error:
rake aborted!
couldn't find file 'jquery'
To make sure I ran rake `assets:precompile` again to see if I wouldn't get
any errors and I again hit another error but it is different from the error
I got above:
rake aborted!
Invalid CSS after " background:url(": expected expression (e.g. fr,
2n+1), was "<%= asset_path ..."
I though the jquery-rails gem was supposed to load jquery for me. Is it
that I don't need to include jquery and jquery_ujs in my application.js
file?
Here is what my environment is like:
>
> Rails Version: 3.2.3
> Ruby Version: 1.9.3 (RVM)
>
> Gemfile
> ...
> gem 'jquery-rails', '~> 2.0.1'
> ...
>
> app/assets/javascripts/application.js
> ....
> //= require jquery
> //= require jquery_ujs
> //= require_tree .
>
> app/assets/javascripts/custom.js
> $(function(){
> $('#roles_menu').hide();
> $('#issues_menu').hide();
> $('#features_menu').hide();
> $('#roles_menu_link').click(
> function(){
> if($('#roles_menu').is(':hidden')){
> $('#roles_menu').slideDown('slow');
> // $('#roles_menu_link').html("<a href='#'
> id='roles_menu_link'>hide roles menu</a>");
> } else{
> $('#roles_menu').slideUp('slow');
> // $('#roles_menu_link').html("<a href='#'
> id='roles_menu_link'>show roles menu</a>");
> }
> });
>
> $('#issues_menu_link').click(
> function(){
> if($('#issues_menu').is(':hidden')){
> $('#issues_menu').slideDown('slow');
> // $('#issues_menu_link').html("<a href='#'
> id='issues_menu_link'>hide issues menu</a>");
> } else{
> $('#issues_menu').slideUp('slow');
> // $('#issues_menu_link').html("<a href='#'
> id='issues_menu_link'>show issues menu</a>");
> }
> });
>
> $('#features_menu_link').click(
> function(){
> if($('#features_menu').is(':hidden')){
> $('#features_menu').slideDown('slow');
> // $('#features_menu_link').html("<a href='#'
> id='features_menu_link'>hide features menu</a>");
> } else{
> $('#features_menu').slideUp('slow');
> // $('#features_menu_link').html("<a href='#'
> id='features_menu_link'>show features menu</a>");
> }
> });
> });
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/0bv005QSUFEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.