Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8717077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:13:48+00:00 2026-06-13T06:13:48+00:00

I’m getting back into Rails (it’s been a few years) so I’m pretty sure

  • 0

I’m getting back into Rails (it’s been a few years) so I’m pretty sure I’m just missing something simple. Tho it could also be my lack of understand of how javascript works within Rails.

I think I have my view (in haml) set up correctly. I have added the javascript to a file that I made sure was included in the layout. (And the css looks right.) I’m just not getting the javascript function (a slideshow I found online) to connect to the view. I’m trying to use %body{ :onload => setUpslideShow() }

Here’s my view:

%body{ :onload => setUpSlideShow() }

%script{type: 'text/javascript'}
  if ( ! window.CMFmainmenu ) { CMFmainmenu = {}; }
  var s                   = CMFmainmenu;
  s.user_id               = "#{@user.id.to_s}";
  s.partial_mainmenu_path = "/users/" + s.user_id + "/xx/mainmenu";
  s.add_new_senior        = "#{UsersController::ADD_NEW_SENIOR}"
  s.add_new_senior_path   = "#{new_seniors_settings_path(@locale,@user,@senior)}"

#mainmenu

... (edited out to save space) ...

 #slideshow.greenBorder
        #slides
          = image_tag '/assets/newlook/div_1_img.png', class: 'slide'
          %p
            Everyone loves photo albums.
            Get your user ready to brag, and
            populate and arrange albums by
            event, special people, year or any
            category you can imagine.
            =link_to "Learn how.", ''
          = image_tag '/assets/newlook/div_2_img.png', class: 'slide'
          %p
            If typing is difficult for your
            loved one, remove the frustration
            of a typed response. They can
            respond with a voice message, or
            with auto replies that you set up.
            =link_to "Learn how.", ''
          = image_tag '/assets/newlook/div_3_img.png', class: 'slide'
          %p
            Arms too short? You can specify
            the minimum font size used for
            your user's email.
            =link_to "Learn how.", ''
        #slides-controls
          1
          2
          3

Here’s my javascript:

if (! window.CMFuser) { CMFuser = {}; }

$(function() {

    var s = CMFuser;

... (edited out to save space) ...

       // slideshow

       slidePrefix            = "slide-";
       slideControlPrefix     = "slide-control-";
       slideHighlightClass    = "highlight";
       slidesContainerID      = "slides";
       slidesControlsID       = "slides-controls";

       setUpSlideShow =  function()
       {
... lots of code that doesn't get called so I'm leaving it out to save space ...

And here’s what I think the relevant line is in the layout: = javascript_include_tag "lib/modernizr-2.0.6.min", "lib/respond.min","application", "users" where “users” is the javascript file. When I comment out the %body{ :onload => setUpslideShow() }, the javascript file appears in the html source.

The full text of the error:

NoMethodError in Users#mainmenu

Showing /opt/cmf/app/views/users/mainmenu.html.haml where line #4 raised:

undefined method `setUpSlideShow' for #<#<Class:0x007fe054fa0a28>:0x007fe05594ae20>
Extracted source (around line #4):

2: - # users/mainmenu
3: 
4: %body{ :onload => setUpSlideShow() }

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:13:49+00:00Added an answer on June 13, 2026 at 6:13 am

    Shouldn’t the value for :onload be a string?

    %body{ :onload => 'setUpSlideShow()' }
    

    You do want to produce this HTML after all, right?

    <body onload="setUpSideShow()">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am currently running into a problem where an element is coming back from
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.