ruby on rails - Syntactic Errors in project files only in my system -
i getting syntactic errors in ruby files in scheme although these not there in other systems.
the errors in code like:
1) redirect_to :back, alert: exception.message
the syntactic error in alert
2) load_and_authorize_resource only: [ :update, :destroy ]
the syntactic error in only
3) render json: @reward.to_json
the syntactic error in json
like there number of errors.
i getting rid of these errors doing next changes above:
1) redirect_to :back, :alert => exception.message
2) load_and_authorize_resource :only => [ :update, :destroy ]
3) render :json => @reward.to_json
it seems error due ruby version not sure what's proper reason is?
i need such changes in every existing projects , quite painful.
does imply projects using old ruby syntax or imply have old ruby version installed?
my ruby version ruby 1.9.2p180
also if ruby version problem ruby upgrade latest version impact whole project , how accomplish ?
update:
i confirmed ruby version ruby 1.9.2p180
because of following:
d:\ruby_work>ruby -v ruby 1.9.2p180 (2011-02-18) [i386-mingw32] d:\ruby_work>pik list 187: ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32] * 192: ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
the asteric(*) above indicating version using.
the exact errors illustration in redirect_to :back, :alert => exception.message
is-
, unexpected ':'
update:
now did -
d:\ruby_work>pik utilize 187 d:\ruby_work>pik list * 187: ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32] 192: ruby 1.9.2p180 (2011-02-18) [i386-mingw32] d:\ruby_work>ruby -v ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32]
the error still there. suspect ruby error because changing older ruby version showing same syntactic error. difference changing :key
key =>
showing same error.
older versions of ruby didn't understand hash notation of key: value
, :key => value
, 1.9+ understands.
i don't remember when new notation added, but, found, prepare allow code run on older versions utilize original notation.
in ruby 1.8.7, error using irb:
irb(main):001:0> foo = {a:'b'} syntaxerror: compile error (irb):1: syntax error, unexpected tsymbeg, expecting kdo or '{' or '(' foo = {a:'b'} ^ (irb):1: syntax error, unexpected '}', expecting $end (irb):1 irb(main):002:0> foo = {:a => 'b'} => {:a=>"b"} ruby-on-rails ruby ruby-on-rails-3.1
No comments:
Post a Comment