Further on migrating my ancient 1.8.6 Rails 2.3.2 app from Windows to
Linux
Mint, whatever I do, I keep getting the same error pertaining to “* A
key
is required to write a cookie containing the session data. Use
config.action_controller.session = { :key => “_myapp_session”, :secret
=>
“some secret phrase” } in config/environment.rb.”* This is true if I run
run ruby script/server, or rake rails:update. However, in my
config/environent.rb, I already have this statement the error is telling
me
I needed (in fact, it was commented out, but uncommenting it changes
nothing for me, I keep getting the same error whenever I go to run
something here). Anyone have an idea where else I can look here? Thaks,
RVic
ruby script/server
/home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:163:in ensure_session_key': A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key => "_myapp_session", :secret => "some secret phrase" } in config/environment.rb (ArgumentError) from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:74:ininitialize’
from
/home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/middleware_stack.rb:72:in new' from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/middleware_stack.rb:72:inbuild’
from
/home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/middleware_stack.rb:116:in build' from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/activesupport-2.3.2/lib/active_support/inflector.rb:361:ininject’
from
/home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/middleware_stack.rb:116:in each' from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/middleware_stack.rb:116:ininject’
from
/home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/middleware_stack.rb:116:in build' ... 8 levels... from ./script/../config/boot.rb:11:inboot!’
from ./script/…/config/boot.rb:110
from script/server:2:in `require’
from script/server:2
Further on migrating my ancient 1.8.6 Rails 2.3.2 app from Windows to Linux
Mint
Are you sure your time wouldn’t be better spent just moving straight
to current versions of Ruby and Rails?
It might actually be easier than what you’re doing now, and at the end
you’d have something besides a running but obsolete application with
known security vulnerabilities…
On Mon, Oct 28, 2013 at 4:09 PM, Hassan S. < [email protected]> wrote:
Hassan,
Oh I certainly will be migrating it – I;ve just got the order though to
get this thing up and running in a linux vm asap. Hopefully, Im not far
from that. But there;s a lot that Iwill have to migrate to the new
mechanisms (routes are different, invoking the server is different,
etc.)
Thank you!
Further on migrating my ancient 1.8.6 Rails 2.3.2 app from Windows to Linux
Mint, whatever I do, I keep getting the same error pertaining to " A key is
required to write a cookie containing the session data. Use
config.action_controller.session = { :key => “_myapp_session”, :secret =>
“some secret phrase” } in config/environment.rb." This is true if I run run
ruby script/server, or rake rails:update. However, in my
config/environent.rb,
Make Time.zone default to the specified zone, and make Active Record
store time values
# in the database in UTC, and return them converted to the
specified
local zone.
# Run “rake -D time” for a list of tasks for finding time zone
names.
Comment line to use default local time.
config.active_record.default_timezone = :utc
See Rails::Configuration for more options
Your secret key for verifying cookie session data integrity.
If you change this key, all old sessions will become invalid!
Make sure the secret is at least 30 characters and all random,
no regular words or you’ll be exposed to dictionary attacks.
The above line should not be commented out, but should of course
reference ‘2.3.2’. I don’t know whether that might have anything to
do with it or not.
Bootstrap the Rails environment, frameworks, and default configuration
Specifies gem version of Rails to use when vendor/rails is not present
#config.frameworks -= [ :action_web_service, :action_mailer ]
BELOW**
Have you done the above? Either do that and/or comment out the line
config.active_record.schema_format = :sql
Comment line to use default local time.
:key => “_gg_session”,
config.gem “actionmailer”
inflect.plural /^(ox)$/i, ‘\1en’
Colin
Colin, I made the changes you said to make here (I did, well before, do
rake db:sessions:create and have the table resident in the db). I;ve lso
tried using :session_key in instead of :key…noe of which seems to be
affecting it:
ruby script/server
/home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:163:in ensure_session_key': A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key => "_myapp_session", :secret => "some secret phrase" } in config/environment.rb (ArgumentError) from /home/user/.rvm/gems/ruby-1.8.6-p420/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:74:in initialize’
It is very odd, firstly it should not be using the cookie store, and
if it were then you have provided the session key. I have tried it
and it works for me with either :key or :session_key, and if I enable
the active_record_store then it does not ask in the first place.
That all looks ok. Sorry I am out of ideas. I can only suggest that
you try making a new app (I can’t remember how to do that in rails 2,
you will have to look it up if you don’t know), and see if that works.
Then if that works add stuff in from your app till it breaks.
The database login parameters have changed – when I change that, it
gets
past that error (give me a new one, of coursem but that must be the
problem). I fixed it in database.yml.
#set default type to html. Options are “text/plain”, “text/html”, and
“text/enriched”. The default value is “text/plain”.
config.action_mailer.default_content_type = “text/html”
these options are only needed if you choose smtp delivery
When I did rails - v, shouldn;t it have just returned 2.3.2 ?
Yes. I’m late to the party here, but are you using rvm on this server?
What does your PATH look like? If you aren’t using rvm, then have you
tried using sudo, as in
sudo gem install rails -v 2.3.2
Without rvm, you may be installing these binaries somewhere that your
PATH can’t find them.
Uh, well. It looks like rvm is installed, but you’re not actually using
it.
If you were, your path would start with the rvm bin directories for the
ruby and gemset you’d selected. Which it obviously doesn’t.
Easy test: what does rvm current report? If it’s not what you want,
that’s the first thing to fix.