Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#3981 closed defect (fixed)

Rails code does not run under ruby 1.9

Reported by: Zverik Owned by: rails-dev@…
Priority: minor Milestone:
Component: website Version:
Keywords: Cc:

Description

The following error occurs when doing rake db:migrate:

C:/Ruby192/rails/app/models/spam_observer.rb:6: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
    when record.is_a?(User): user = record
                            ^
C:/Ruby192/rails/app/models/spam_observer.rb:7: syntax error, unexpected keyword_when, expecting keyword_end
    when record.is_a?(DiaryEntry): user = record.user
        ^
C:/Ruby192/rails/app/models/spam_observer.rb:7: syntax error, unexpected ':', expecting keyword_end
    when record.is_a?(DiaryEntry): user = record.user
                                  ^
C:/Ruby192/rails/app/models/spam_observer.rb:8: syntax error, unexpected keyword_when, expecting keyword_end
    when record.is_a?(DiaryComment): user = record.user
        ^
C:/Ruby192/rails/app/models/spam_observer.rb:8: syntax error, unexpected ':', expecting keyword_end
    when record.is_a?(DiaryComment): user = record.user
                                    ^
C:/Ruby192/rails/app/models/spam_observer.rb:15: syntax error, unexpected keyword_end, expecting $end

Change History (9)

comment:1 Changed 8 years ago by Tom Hughes

Priority: majorminor
Summary: Rails Port does not compile (spam_observer.rb)Rails code does not run under ruby 1.9

You appear to be using ruby 1.9 which is completely untested.

Our code is written for, and runs on, ruby 1.8 based systems, and there are probably a number of changes that will needed for 1.9 support.

comment:2 Changed 8 years ago by Tom Hughes

Owner: changed from Tom Hughes to rails-dev@…

comment:3 Changed 7 years ago by bithive

I have committed a fix for this problem to my github fork:

https://github.com/bithive/openstreetmap-website/commit/03991a45d93ed8a9e9430a940f3d55f6371433b7

There are other changes required for 1.9, look at the subsequent commits to the above fork.

comment:4 Changed 7 years ago by Tom Hughes

It's unlikely that we will try and support running on 1.9 until such time as I am in a position to easily test on it, which basically means when either Fedora or Ubuntu LTS has it.

comment:5 Changed 7 years ago by ppawel@…

Works for me with ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]. Can be closed?

comment:6 Changed 7 years ago by Tom Hughes

Resolution: fixed
Status: newclosed

Yes I believe this is likely fine now as I have been running 1.9 on my development machine for some months now without encountering any further problems.

comment:7 Changed 7 years ago by jfire

Same here.

Is the production server still on 1.8? If so, we should consider updating, as 1.9 is significantly faster.

comment:8 Changed 7 years ago by Tom Hughes

Yes, because 1.8 is still what comes with Ubuntu.

comment:9 Changed 7 years ago by Tom Hughes

That said, we are actually using the ruby from http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu now, which actually has both, so we could switch if we didn't mind committing to not being able to go back to the standard Ubuntu build.

I'd need to work out to do it non-disruptively though...

Note: See TracTickets for help on using tickets.