Problem using Locomotive

Hi,

I’ve installed locomotive and all seemed to be fine. The localhost
works and I can make a new project and generate controllers, views etc.
However as soon as I put some Ruby code in a view html page I get a
Syntax Error. Even just trying to use date won’t work.

Anyone know where I’m going wrong? I’m keen to get coding!

Thanks in advance.

Go ahead and paste the contents of your view.html file and also
copy-and-paste the exact error you’re getting. That will help us find
the
problem.

hello.rhtml in app/views/say

Hello, Rails!

Hello from Rails

It is now <%/= @time %>.

say_controller.rb in app/controllers

class SayController < ApplicationController
def hello
@time = Time.now
end
end

http://localhost:3000/say/hello

SyntaxError in Say#hello

Showing app/views/say/hello.rhtml where line #1 raised:

compile error
/Users/jim/Documents/work/demo/config/…/app/views/say/hello.rhtml:1:
unknown regexp option - p
/Users/jim/Documents/work/demo/config/…/app/views/say/hello.rhtml:1:
parse error, unexpected $undefined.
_erbout = ‘’; _erbout.concat "\r \r Hello,
Rails!\r \r \r

Hello from Rails

\r

\r It is now "; /= @time ; _erbout.concat ".\r

\r \r\r"; _erbout
                                                    ^

/Users/jim/Documents/work/demo/config/…/app/views/say/hello.rhtml:1:
unknown regexp options - htl
/Users/jim/Documents/work/demo/config/…/app/views/say/hello.rhtml:1:
parse error, unexpected $undefined.
_erbout = ‘’; _erbout.concat "\r \r Hello,
Rails!\r \r \r

Hello from Rails

\r

\r It is now "; /= @time ; _erbout.concat ".\r

\r \r\r"; _erbout
^

/Users/jim/Documents/work/demo/config/…/app/views/say/hello.rhtml:1:
unterminated string meets end of file
/Users/jim/Documents/work/demo/config/…/app/views/say/hello.rhtml:1:
parse error, unexpected $, expecting kEND
Extracted source (around line #1):

1:

Hello, Rails!

Hello from Rails

It is now <%/= @time %>.

Trace of template inclusion: /app/views/say/hello.rhtml

RAILS_ROOT: /Users/jim/Documents/work/demo/config/…

Thankyou - Any help appreciated. I can’t get past this error.

On 11/16/06, cmcfarland [email protected] wrote:

<p>
 It is now <%/= @time %>.

Remove the forward slash in this line. ERb tags are <%= %> (output
rendered)
or <% %> (output not rendered).

Matt

</p>

It is now <%/= @time %>

Seems to be a simple typeing error…
See the slash ( / ) you have in front of the " = " ? thats wrong …
the parser seems to see it as ather start of a regular expression
pattern, which are usually ecapsulated in slashes … /pattern/

try:
It is now <%= @time %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs