two rails 0.14.1 problems in win

J

Jose Luis Zabalza

------=_Part_16290_19769068.1130231669109
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

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
=3D> Rails application started on http://0.0.0.0:3000
=3D> 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=3D700 port=3D3000

------------> 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/callba=
cks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callba=
cks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callba=
cks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callba=
cks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callba=
cks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callba=
cks.rb:215:in
`instantiate_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.1/lib/active_record/callba=
cks.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

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

module ActiveRecord
module Callbacks
CALLBACKS =3D %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 =3D 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

[...]

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D

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

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

module ActiveRecord
module Callbacks
CALLBACKS =3D %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

[...]
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D

And now run. Is it a bug?



--
Jos=E9 Luis Zabalza
(e-mail address removed)
Linux Counter 172551

------=_Part_16290_19769068.1130231669109--
 
S

Sascha Ebach

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top