Scriplets are not working

Newbie to Ruby, working on examples Agile Development with Rails2.

<ul>
<li>Addition: <%= 1+2 %> </li>
<li>Concatenation: <%= "cow" + "boy" %> </li> 1.hour.from_now
<li>Time in one hour: <%= 1.hour.from_now %> </li>

this code simplly prints like this

Addition:
Concatenation: 1.hour.from_now
Time in one hour:

dynamic code is not displayed. I don't understand what was the problem.

I restarted the server for serverl times, but no use.

Please help

I just ran your code snip and it worked fine for me. What is the name of the your view?

James,

name of my view is hello.rhtml.

James Mitchell wrote:

Any one got this problem ?

Please paste your code exactly how you have it.

I’m thinking the 1st and 3rd don’t have the = with them.

Before you said the second one worked, and now you said it hasn’t.

Which is it?

Hi Ryan,

My hello.rhtml code is like this.

<li>Addition: <%= 1+2 %> </li>
<li>Concatenation: <%= "cow" + "boy" %> </li>
<li>Time in one hour: <%= 1.hour.from_now %> </li>

and the controller class is say_controller.rb

class SayController < ApplicationController
  def hello
  end
end

and if i try to execute the code in using this URL

http://localhost:3000/say/hello

the output of the code is

Addition:
Concatenation: 1.hour.from_now
Time in one hour:

Why it is not executing the scriptlet code.

-Vijay

Vijay,
It looks like you are typing things in the email. You should copy and paste everything, because you are making transcription errors in preparing the emails.

Also, do a "view source" in the browser and paste that.

Hello,

try with out

  • tag

    regards

    sumesh

  • Hi George Bailey,

    Here is my view source code from IE 6.0

    <ul>
    <li>Addition: <%= 1+2 %> </li>
    <li>Concatenation: <%= "cow" + "boy" %> </li> 1.hour.from_now
    <li>Time in one hour: <%= 1.hour.from_now %> </li>

    -Vijay.

    Sumesh,

    Tried with the below code

    Addition: <%= 1+2 %>
    Concatenation: <%= "cow" + "boy" %>
    Time in one hour: <%= 1.hour.from_now %>

    output is

    Addition: Concatenation: Time in one hour:

    Vijay.

    All,

    Anyone having the similar issue.

    Vijay

    I WAS ABLE TO SEE THE VIEW SOUCE COD AS

    Addition: <%= 1+2 %>
    Concatenation: <%= "cow" + "boy" %>
    Time in one hour: <%= 1.hour.from_now %>

    BUT THE output is

    Addition: Concatenation: Time in one hour:

    Any one got this kind of issue.

    it's working now, i have just created another view, it's working fine.

    Thanks one and all...