Two rails 0.14.1 problems in win

Hello everybody.

I have problems starting with rails.
I hope this description is enough.

C:\proys>ruby --version
ruby 1.8.2 (2004-12-25) [i386-mswin32]

C:\proys\specs4> gem list --local

C:\proys\specs4>"c:\ruby\bin\ruby.exe" "c:\ruby\bin\gem" list --local

*** LOCAL GEMS ***

actionmailer (1.1.1)
Service layer for easy email delivery and testing.

actionpack (1.10.1)
Web-flow and rendering framework putting the VC in MVC.

actionwebservice (0.9.1)
Web service support for Action Pack.

activerecord (1.12.1)
Implements the ActiveRecord pattern for ORM.

activesupport (1.2.1)
Support and utility classes used by the Rails framework.

[...]

rails (0.14.1)
Web-application framework with template engine, control-flow layer,
and ORM.

rake (0.6.2)
Ruby based make-like utility.

[...]

C:\proys>rails specs4
create
create app/apis
create app/controllers
[...]
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log

--------------> Editing configuration

C:\proys>cat specs4\config\database.yml

development:
adapter: mysql
database: specs
socket: localhost
username: root
password:

test:
adapter: mysql
database: specs
socket: localhost
username: root
password:

production:
adapter: mysql
database: specs
socket: localhost
username: root
password:

------------>There is a database (specs) with a table (tareas)

C:\proys>cd specs4

C:\proys\specs4>ruby script\generate scaffold Tareas
exists app/controllers/
exists app/helpers/
create app/views/tareas
exists test/functional/
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/tareas.rb
create test/unit/tareas_test.rb
create test/fixtures/tareas.yml
stack level too deep

oooooooops there are some problem
OK. Continue for a longer way.

C:\proys\specs4>ruby script\generate controller Tareas
exists app/controllers/
exists app/helpers/
exists app/views/tareas
exists test/functional/
create app/controllers/tareas_controller.rb
create test/functional/tareas_controller_test.rb
create app/helpers/tareas_helper.rb

C:\proys\specs4>ruby script\generate model Tarea
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/tarea.rb
create test/unit/tarea_test.rb
overwrite test/fixtures/tareas.yml? [Ynaq] y
force test/fixtures/tareas.yml

-----------> Editing tareas controller

C:\proys\specs4>cat app\controllers\tareas_controller.rb
class TareasController < ApplicationController
scaffold :tarea
end

C:\proys\specs4>ruby script\server
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2005-10-24 20:12:14] INFO WEBrick 1.3.1
[2005-10-24 20:12:14] INFO ruby 1.8.2 (2004-12-25) [i386-mswin32]
[2005-10-24 20:12:14] INFO WEBrick::HTTPServer#start: pid=700 port=3000

------------> on navigator http://localhost:3000/tareas

SystemStackError in Tareas#index

stack level too deep

Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callbacks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callbacks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callbacks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callbacks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callbacks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callbacks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callbacks.rb:215:in
`instantiate_without_callbacks'

-------------> on console

127.0.0.1 <http://127.0.0.1> - - [24/Oct/2005:20:12:26 Hora de verano
romance] "GET /tareas HTTP/1.
1" 500 291518
- -> /tareas
127.0.0.1 <http://127.0.0.1> - - [24/Oct/2005:20:12:27 Hora de verano
romance] "GET /favicon.ico HT
TP/1.1" 200 0
- -> /favicon.ico

-----------------> Editing the rails code

=======<callbacks.rb>========
require 'observer'

module ActiveRecord
module Callbacks
CALLBACKS = %w(
after_find after_initialize before_save after_save before_create
after_create before_update after_update before_validation
after_validation before_validation_on_create after_validation_on_create
before_validation_on_update
after_validation_on_update before_destroy after_destroy
)

def self.append_features(base) #:nodoc:
super

base.extend(ClassMethods)
base.class_eval do
class << self
include Observable
alias_method :instantiate_without_callbacks, :instantiate
alias_method :instantiate, :instantiate_with_callbacks
end

[...]

module ClassMethods #:nodoc:
def instantiate_with_callbacks(record)
object = instantiate_without_callbacks(record)

if object.respond_to_without_attributes?(:after_find)
object.send(:callback, :after_find)
end

if object.respond_to_without_attributes?(:after_initialize)
object.send(:callback, :after_initialize)
end

object
end
end

[...]

···

==============================

I supous this is not a bug but, I changed to....

=======<callbacks.rb>========
require 'observer'

module ActiveRecord
module Callbacks
CALLBACKS = %w(
after_find after_initialize before_save after_save before_create
after_create before_update after_update before_validation
after_validation before_validation_on_create after_validation_on_create
before_validation_on_update
after_validation_on_update before_destroy after_destroy
)

def self.append_features(base) #:nodoc:
super

base.extend(ClassMethods)
base.class_eval do
class << self
include Observable
alias_method :instantiate_without_callbacks, :instantiate
# --------------> alias_method :instantiate, :instantiate_with_callbacks
end

[...]

And now run. Is it a bug?

--
José Luis Zabalza
jlz.3008@gmail.com
Linux Counter 172551

Hi Jose,

I have problems starting with rails.
I hope this description is enough.

are you using 2 versions of Ruby? It looks like it because you use `cat` which indicates that you use cygwin. It might be that when you just call `ruby` that the cygwin ruby is called. I had a lot of problems with "stack level too deep" months ago with rails-0.8. Try doing

"c:\ruby\bin\ruby.exe" script\generate scaffold Tareas

Sascha Ebach