Ruby on Rails Tuesday, June 26, 2012

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?

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/-/bZ0ic1Fd5aYJ.
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.

No comments:

Post a Comment