What is causing this difference between my Ruby on Rails console output and my Firebug console output when using a Ruby date object?

Can anyone explain the difference between the Ruby on Rails console output and the Firebug console output?


def list_events @days[1][:date] = (((Date.new(2010, 8, 6)) + 1).to_s) end


<% @days.each_with_index do |day, i| %> <% p day[:date] %>; //RoR console console.log(<%= day[:date] %>); //Firebug console <% end %>

Ruby on Rails console output:


Firebug console output:


-------------Problems Reply------------

The JavaScript statement that is actually being executed is this:


—This is evaluated as 2010 minus 8 minus 7, which equals...1995! You have to make sure that the console log statement receives a string. Try this instead:

console.log("<%= day[:date] %>");

Category:ruby on rails Views:9 Time:2010-08-10

Related post

  • Ruby on Rails 3 Tutorial: Entering commands in console issue 2011-12-30

    I am working through this tutorial book and have run into an issue with the rails console not recognizing the user model that I've created. Here is what I am working with This is what I've defined in my user model, user.rb, located in sample_app/app/

  • Ruby on Rails, mysql column type :text, What class is this as a ruby object? 2010-02-15

    你好, When a column in mysql table is typed :text, how is this then treated in Ruby. In other words, what is the class? Is it a string? --------------Solutions------------- Yes. It is a 'String'.

  • Ruby on Rails on Windows: gem install fails, no output at all 2010-06-15

    I installed ruby through the windows installer yesterday. All seemed fine. Today, I went installing the rmagick win32 gem like so: c:\ruby187\bin\gem install rmagick-2.7.1-x86-mswin32.gem in the directory with the gem. That also seemed to work fine,

  • Ruby on Rails 3.0 Why do these two output two different things? 2010-09-17

    <%= link_to 'Testing', wak_path %> *This requires a routes: match 'wak', :to => 'home#wak' Did they take this out of rails 3.0 or what is going on? <%= link_to 'Testing, :controller=>:home,:actions=>:wak %> But in the views, I'm

  • Ruby on rails: XSS prevention: how do I prevent null from being passed as data to my server? 2011-08-08

    While non-IE browsers can handle the null character fine, IE just gives up on life when it encounters a null character. It just stops rendering the page. I figure, since null will never be a legit piece of text in my app, I could block or strip it ou

  • What is the difference between Ruby and Ruby on Rails? 2009-08-06

    I have been studying ruby for the past few days and I have noticed there is Ruby on Rails. What is the difference between the two? Do they work to together? Is the syntax the same? --------------Solutions------------- Ruby is a programming language.

  • Ruby on Rails versus Python 2009-03-12

    I am in the field of data crunching and very soon might make a move to the world of web programming. Although I am fascinated both by Python and Ruby as both of them seem to be having every similar styles when it comes to writing business logic or da

  • What tools do web developers use with PHP, Ruby on Rails, Python, etc? 2009-05-06

    A good friend just sent me the following email My father is putting together a proposal for a local college to start a center of innovation and technology. As part of that, he’s proposing they teach web design and web development. My question is in y

  • Simplest way to send mail with Ruby on Rails 2008-10-25

    What is the simplest way to send mail using Ruby on Rails? Is there a way to send mail directly via ruby and skip all the rails models and complexity, just like php's mail() function? Thanks for your help. --------------Solutions------------- yes che

  • Implicit Tables in Ruby on Rails 2009-05-30

    I'm just learning how to program in Ruby on Rails, and I'm really impressed by how much work the Ruby on Rails framework does for you. I have the following two classes: Object -------- object_id description ObjectGroup -------- group_id description T

  • Web service: PHP or Ruby on Rails or Python? 2009-07-26

    I am a .Net / SQL Server developer via my daytime job, and on the side I do some objective C development for the iPhone. I would like to develop a web service and since dreamhost supports mySql, python, ruby on rails and PHP5, I would like to create

  • Great Ruby on Rails resources 2009-12-12

    I'm generally a PHP dev, but over the past few months I have been dying to get into a new language. I have tried everything, I learned a little Java, not for me; a little Python, I dislike the syntax, I wanted to try Perl, but never got around to it.

  • how to configure netbeans for ruby on rails? 2010-01-07

    how to configure netbeans for ruby on rails ? --------------Solutions------------- Update: Netbeans has dropped support for ruby, unfortunately. The netbeans documentation has sections on that matter: http://netbeans.org/kb/docs/ruby/setting-up.html

  • Convert code from PHP to Ruby on Rails 2010-01-24

    I'm trying to use geoip's web service for a ruby on rails application. They don't give any ruby demos but this is what they give for PHP. I was wondering if anyone knew how to convert this to work on ruby on rails? I only need the city and the region

  • How do I get the current absolute URL in Ruby on Rails? 2010-01-29

    How can I get the current absolute URL in my Ruby on Rails view? The request.request_uri only returns the relative URL. --------------Solutions------------- For Rails 3.2 or Rails 4 You should use request.original_url to get the current URL. This met

  • A book about Ruby On Rails for the Ruby illiterate? 2010-02-02

    Is there a book about Ruby On Rails for someone that has little or no understanding of Ruby? Although Ruby On Rails is a great reason to start learning Ruby, I'd be bored out of my pants if I first have to read a full book on Ruby and then a book abo

  • which technology is best for a Facebook application Ruby on Rails or C# and ASP? 2010-05-13

    My friend and I want to write a Facebook application. We've narrowed down the list of possible technologies to Ruby on Rails and C# with ASP. Here are the pros and cons we've thought of. Cons: ASP - proprietary tools like Visual Studio etc. cost (lot

  • Use a random string as id in Ruby on Rails? 2010-07-02

    I want to create a web app similar to http://www.pastebin.com/ in Ruby on Rails. pastebin.com uses a random string to identify an item. Ruby on Rails uses an auto-incrementing number. How can I make Ruby on Rails also use these random strings as IDs

  • Is Voltdb supported by Ruby on Rails? 2010-12-20

    Can I use Voltdb with Ruby on Rails? --------------Solutions------------- No, while VoltDB does have a Ruby Gem available http://rubyredtomatoes.com/2010/11/01/still-voltdb-and-ruby, http://rubygems.org/gems/voltrb and http://github.com/beljun/VoltRb

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.225 (s). 11 q(s)