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 8329151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:40:40+00:00 2026-06-09T01:40:40+00:00

I have a Day object which contains some statistics and is updated daily. Here’s

  • 0

I have a Day object which contains some statistics and is updated daily. Here’s the two errors I’m getting:

undefined method `top_light_snown’ for #

undefined method `top_agents_snown’ for #

Depending on the contents of the view:

<h3 class='thin underline'>Daily Breakdown:</h3>
<%# debug @today %>
<%# @today.methods %>
Top User Agents Today: <%= @today.top_agents_snown %>
<br>
Top Keyword Triggers <%= @today.top_keyword_triggers %>
<br>
Top URLs Visited <%= @today.top_urls_visited %>
<br>
Top Injections Shown <%= @today.top_inj_shown %>
<br>
Top Popups Shown <%= @today.top_pop_shown %>
<br>
Top Custom Injections Shown <%= @today.top_cust_shown %>
<br>
Top Lightboxes Shown <%# @today.top_light_snown %>
<br>
Top Global Injections Shown <%= @today.top_glob_shown %>

Note that only .top_light_shown and .top_agents_shown cause errors. All the other methods work perfectly fine. Also note the two commented out debug commands. The result of debug @today shows that it does indeed have an attribute “top_light_shown,” it is also present in the list of methods from @today.methods, along with all the other ones used.

Here’s the contents of the controller – as you can see, I’m setting up the new @today Day object and pre-filling it with junk data to see if I could access it from the view. In this case, the if statement will always fail (but even if it doesn’t, I have the same undefined method errors)

if Day.find_by_id(Time.now.day)
      stats_today = Day.find_by_id(Time.now.day)
      @ads_today = stats_today.top_inj_shown.size + stats_today.top_pop_shown.size + stats_today.top_cust_shown.size + stats_today.top_light_shown.size + stats_today.top_glob_shown.size
      @total_pageviews = Day.find_by_id(Time.now.day).pageviews
      @today = Day.find_by_id(Time.now.day)
    else
      @today = Day.new(:top_agents_shown => ['Firefox', 'Chrome'], :top_light_shown => ['l-TEST', 'l-TEST2'])
      puts @today.top_light_shown
      puts @today.top_agents_shown
      @ads_today = 'ERROR'
      @total_pageviews = 'ERROR'
    end

Here’s the server log after requesting the page with the puts working perfectly fine in the controller:

Started GET “/assets/favicons/favicon.ico” for 127.0.0.1 at 2012-08-01
19:13:03 -0600 Served asset /favicons/favicon.ico – 304 Not Modified (1ms)

l-TEST l-TEST2 Firefox Chrome

Started GET “/dashboard” for 127.0.0.1 at 2012-08-01 19:16:38 -0600
Processing by DashboardController#index as HTML

Finally, here’s the contents of the Day.rb:

class Day
    include MongoMapper::Document
    key :number,            Integer

    key :pageviews,         Integer
    key :shown_injs,        Integer
    key :shown_pops,        Integer
    key :shown_custs,       Integer
    key :shown_lights,      Integer
    key :shown_globs,       Integer

    key :top_agents_shown,      Array
    key :top_keyword_triggers,  Array
    key :top_urls_visited,      Array
    key :top_inj_shown,     Array
    key :top_pop_shown,     Array
    key :top_cust_shown,        Array
    key :top_light_shown,       Array
    key :top_glob_shown,        Array

end

What in the world is going on? Why are the IDENTICAL methods with a different name work and others do not? Why those particular two? Why do they work in the controller and not in the view?

  • 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-09T01:40:41+00:00Added an answer on June 9, 2026 at 1:40 am

    Your view calls @today.top_agents_snown, but you define top_agents_shown. Just a misspelling. Some days are like that!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get back a json object from Facebook which contains some friends information. Some
Good day, I have created an object that will manage data access. My app
I have a current Date object that needs to be incremented by one day
i have day, month, year, value columns in one table, here i need to
I have a MySQL database called People which contains the following schema <id,name,foodchoice1,foodchoice2> .
I have web service in PHP which gets dateTime object (from asp) . I
I currently have a business object with a validation business rule, which is it
I have a NSString object testtimeFrame which i am converting to NSMutableString object mutable
i have a holiday table which contains the data are HOLIDAYDA DESCRIPTION --------- --------------------
I have a graph object, that I need to serialize. Nomatter which members i

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.