i want to resolve this error, anyone please, this error is about syntax error in session_store.rb file, at attachment in pastie:
http://pastie.org/2681282
It looks like you're trying to use Ruby 1.9-style Hash syntax (key: value) in Ruby 1.8. Either upgrade to Ruby 1.9 or change your code to use the Hash syntax supported in Ruby 1.8, i.e. :key => '_manager_session'.
Checkout my answer here:
Mac OSX Snow Leopard - Rails error: Session_store.rb
Related
I have searched documentation to this error that I have never seen before in working with Ruby on Rails. I just got a new MacBook and I installed Rails 4.2 and Ruby 2.4 and when I attempt to run rails server, I get this error:
.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155: warning: constant ::Fixnum is deprecated
How do I eliminate this error that is keeping me from starting up the Rails server?
Im not sure if that's the issue, since what you are seeing is just a warning. That warning appears because you are using ruby 2.4.0.
This version introduced this change: Unify Fixnum and Bignum into Integer
See here for the announcement: https://www.ruby-lang.org/en/news/2016/12/25/ruby-2-4-0-released/Z
The warnings come from the activesupport gem which is part of rails, and they will fix it soon.
Try downgrading your Ruby Version to 2.1 and try again.
Source
My application works fine locally, but when i'm installing it to production server, i get the following error running rails server and requesting page:
ActionView::Template::Error (can not load translations from {app}/config/locales/ru.yml, expected it to return a hash, but does not).
I have YAML translation ru.yml:
ru:
clients:
index:
title: Список клиентов
And error happens while calling, ex:
%h1=t '.title'
My development machine is running Mac OS X ML
Production server is CentOS 6 with rvm and libyaml installed.
Both servers are on Ruby 1.9.2p320 and Rails 3.2.8
Operation YAML.load(File.open('config/locales/ru.yml')) gave me error in one of lines.
I added quotes: default: '%d.%m.%Y %H:%M' and got a hash. Problem is solved.
The problem is about using psych YAML engine which can not parse strings with % sign and generates SyntaxError exception.
Use syck engine instead. Add the following code to the end of your config/boot.rb file
YAML::ENGINE.yamler = 'syck'
hint: syck requires Ruby version >= 2.0.0.
I try to create a standalone migration file by executing the following command:
rails generate migration LoadData
But I got the following error:
PATH-TO/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
PATH-TO/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `gem_original_require'
...
I am using Rails v2.3 and ruby Enterprise edition. Why I got this error, how to get rid of it?
This is an incompatibility between some version of Rails 2.3.xx and recent versions of RubyGems. I got this error with Rails 2.3.4 and then used a more recent version of Rails 2.3.11 as of now to get rid of this error.
In case it is not possible to update the Rails version, then in your RakeFile add in the beginning.
require "thread"
Downgrading the RubyGems version will also help. Afaik Rubygems version 1.3.5 is compatible with Rails 2.3.4 and 2.3.5.
Hope this helps.
rails 3.1 with ruby 1.9.2p290 on windows generates
initialers/config/session_store.rb
Hello::Application.config.session_store :cookie_store, key: '_hello_session'
key: 'hello_session' is :key => 'hello_session' in some of my old apps. What makes rails to generate different codes? Ruby version or rails version ?
There's a new hash syntax in ruby 1.9, you can write:
{key: "hello_session"}
instead of:
{:key => "hello_session"}
The 1.8 syntax is still supported, use it if you want your app to be compatible with both 1.8 and 1.9.
I resolved this by removing my ~/.rvm directory and reinstalling RVM.
I have just set up a new project which displays all the correct info in the about your applications environment window when on http://localhost:3000/ but when I run it at http://egg.dev/ I get:
SyntaxError: /users/davidhall/work/egg/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end
...sion_store :cookie_store, key: '_egg_session'
^
I'm sure I had this problem earlier, which was due to me using rails 3.1 with ruby 1.8.7, the problem resolved when I used ruby 1.9.2. Now I'm getting when using 1.9.2 too.
Thanks for any help its much appreciated!
The Problem is that, there is a new-style hash argument available in Ruby1.9.2 but unavailable in Ruby1.8.7 which is
key: value # only available in 1.9.2
||
:key => value # available in 1.8.7 and 1.9.2
so, with a less effort, you can just modify the syntax to the one that 1.8.7 recognized.
As you can read in the Pow User's Manual under point 2.3 you have to add a .rvmrc into the root directory of your project with the content rvm 1.9.2.
Then it should work!
I resolved this by deleting the ~/.rvm directory and reinstalling RVM.