No Migration Files are created

16 views
Skip to first unread message

Ryo Saeba

unread,
Mar 14, 2013, 1:13:15 PM3/14/13
to rubyonra...@googlegroups.com
I've been working with Rails for 3 Months now, but haven't experienced
this problem until now. I'm currently working through Micharl Hartls
Tutorial and everything worked fine so far, but suddenly (chapter 11) I
can nolonger create Migration Files.

when entering "rails g model Name field1:type" I don't get the usual
"create db/migrate...." status lines in the console, but instead tons of
location links
(C:/Programs/Railsinstaller/Ruby1.9.3/lib/ruby/gems/...activesupport".

On the Top it says "Block in cunstantize: uninitialized constant cacher
8NameError)

And no migrationfiles are created in the db folder. I tested the "rails
g controller"-command which works fine. Also creating new models
/migrations in other projects do work. But creating migrations in this
specific "sample_app" is no longer possible and I just don't know why. I
couldn't find anything about this problem on the web either. I hope you
guys are familiar with this problem and can help me out :/

Greetz Sir Jay

--
Posted via http://www.ruby-forum.com/.

Colin Law

unread,
Mar 14, 2013, 5:27:24 PM3/14/13
to rubyonra...@googlegroups.com
On 14 March 2013 17:13, Ryo Saeba <li...@ruby-forum.com> wrote:
> I've been working with Rails for 3 Months now, but haven't experienced
> this problem until now. I'm currently working through Micharl Hartls
> Tutorial and everything worked fine so far, but suddenly (chapter 11) I
> can nolonger create Migration Files.
>
> when entering "rails g model Name field1:type" I don't get the usual
> "create db/migrate...." status lines in the console, but instead tons of
> location links

"rails g model Name field1:type" is not a valid command. It should be
field1:string or whatever. If that is not the exact command that you
used then show us the exact command and the full stack trace that it
generates. Copy/paste it here, including the command you are typing.

> (C:/Programs/Railsinstaller/Ruby1.9.3/lib/ruby/gems/...activesupport".
>
> On the Top it says "Block in cunstantize: uninitialized constant cacher
> 8NameError)

I doubt very much whether it says that. Remember that when asking a
question it is vital to get the details correct. A question full of
typing errors is very difficult to answer. That is why it is better
to copy/paste.

Colin

Ryo Saeba

unread,
Mar 15, 2013, 3:56:03 AM3/15/13
to rubyonra...@googlegroups.com
All right, this is what I get, wehen I type "rails g Model DingDong"

C:\Sites\sample_app>rails g model DingDong
SECURITY WARNING: No secret option provided to
Rack::Session::Cookie.
This poses a security threat. It is strongly recommended that
you
provide a secret to prevent exploits that may be possible from
crafted
cookies. This will not be supported in future versions of Rack,
and
future versions will even invalidate your existing user cookies.

Called from:
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/g
ems/actionpack-3.2.1/lib/action_dispatch/middleware/session/abstract_store.rb:28
:in `initialize'.

invoke active_record
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2
.1/lib/active_support/inflector/methods.rb:229:in `block in
constantize': uninit
ialized constant Cacher (NameError)
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vesupport-3.2.1/lib/active_support/inflector/methods.rb:228:in `each'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vesupport-3.2.1/lib/active_support/inflector/methods.rb:228:in
`constantize'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vesupport-3.2.1/lib/active_support/core_ext/string/inflections.rb:54:in
`constan
tize'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vemodel-3.2.1/lib/active_model/observing.rb:86:in `instantiate_observer'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vemodel-3.2.1/lib/active_model/observing.rb:59:in `block in
instantiate_observer
s'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vemodel-3.2.1/lib/active_model/observing.rb:59:in `each'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vemodel-3.2.1/lib/active_model/observing.rb:59:in
`instantiate_observers'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
verecord-3.2.1/lib/active_record/railtie.rb:111:in `block (2 levels) in
<class:R
ailtie>'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:36:in
`instance_eval'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:36:in
`execute_hook'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:43:in `block in
run_load_h
ooks'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:42:in `each'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
vesupport-3.2.1/lib/active_support/lazy_load_hooks.rb:42:in
`run_load_hooks'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
verecord-3.2.1/lib/active_record/base.rb:716:in `<top (required)>'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rail
ties-3.2.1/lib/rails/generators/named_base.rb:162:in
`pluralize_table_names?'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rail
ties-3.2.1/lib/rails/generators/named_base.rb:110:in `table_name'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
verecord-3.2.1/lib/rails/generators/active_record/model/model_generator.rb:17:in
`create_migration_file'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/task.rb:22:in `run'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:124:in `each'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:124:in `map'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/group.rb:226:in `dispatch'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:109:in `invoke'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/group.rb:269:in `block in _invoke_for_class_method'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/shell.rb:74:in `with_padding'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/group.rb:258:in `_invoke_for_class_method'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/group.rb:150:in `_invoke_from_option_orm'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/task.rb:22:in `run'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:124:in `each'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:124:in `map'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/group.rb:226:in `dispatch'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
-0.14.6/lib/thor/base.rb:389:in `start'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rail
ties-3.2.1/lib/rails/generators.rb:170:in `invoke'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rail
ties-3.2.1/lib/rails/commands/generate.rb:12:in `<top (required)>'
from
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rail
ties-3.2.1/lib/rails/commands.rb:29:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

I used the very same command line in another project directory a few
moments earlierer and it worked as usual there...But nothing that
involves Migration would work in my sample_app

Colin Law

unread,
Mar 15, 2013, 5:08:01 AM3/15/13
to rubyonra...@googlegroups.com
On 15 March 2013 07:56, Ryo Saeba <li...@ruby-forum.com> wrote:
> All right, this is what I get, wehen I type "rails g Model DingDong"

Please don't top post, it makes it difficult to follow the thread.
Insert your replies inline in the previous message. Remember this is
a mailing list not a forum (though you may be accessing it using a
forum-like interface).

>
> C:\Sites\sample_app>rails g model DingDong

I don't use Windows so I may not be able to help, but I will have a go.

> [snip]

> invoke active_record
> C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2
> .1/lib/active_support/inflector/methods.rb:229:in `block in
> constantize': uninit
> ialized constant Cacher (NameError)

> [snip]

> C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/acti
> verecord-3.2.1/lib/rails/generators/active_record/model/model_generator.rb:17:in
> `create_migration_file'
> from
> C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor
> -0.14.6/lib/thor/task.rb:22:in `run'

I am a bit surprised to see thor there, does railstutorial use thor?

Colin

Frederick Cheung

unread,
Mar 15, 2013, 6:15:44 AM3/15/13
to rubyonra...@googlegroups.com
On Friday, March 15, 2013 7:56:03 AM UTC, Ruby-Forum.com User wrote:
All right, this is what I get, wehen I type "rails g Model DingDong"

C:\Sites\sample_app>rails g model DingDong

      invoke  active_record
C:/Programme/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2
.1/lib/active_support/inflector/methods.rb:229:in `block in
constantize': uninit
ialized constant Cacher (NameError)

Something is trying to load an activerecord observer called Cacher that apparently doesn't exist. If you search your app for references to that you should hopefully find where you're using it.

Fred

tamouse mailing lists

unread,
Mar 15, 2013, 7:02:00 AM3/15/13
to rubyonra...@googlegroups.com
Thor gets bundled in with Rails somewhere.

Colin Law

unread,
Mar 15, 2013, 7:05:47 AM3/15/13
to rubyonra...@googlegroups.com
Yes you are right, I see that since Rails 3 the generators use thor.
I had missed that.

thanks

Colin

Ryo Saeba

unread,
Mar 15, 2013, 11:06:45 AM3/15/13
to rubyonra...@googlegroups.com
Thanks a lot Fred, you really helped me out!

It looks like I used the wrong codeline in my application.rb

Michael Hartls Tutorial required me to uncomment "
config.active_record.whitelist_attributes = true
"

but instead I accidentally uncommented " #
config.active_record.observers = :cacher, :garbage_collector,
:forum_observer
" which caused this error.

pretty stupid, but hey, that wouldn't happen again! :D
Reply all
Reply to author
Forward
0 new messages