Piers Harding
2005-Apr-29 12:04 UTC
Problems with MissingSourceFile in <controller not set>#<action not set> in todo tutorial
Hello All, I''ve just been playing with the Rails "ToDo" tutorial (at http://darkhost.mine.nu:81/~vince/rails/tutorial.html ), and I have ben thrown this error: MissingSourceFile in <controller not set>#<action not set> I realise - by using the latest gem install for rails - that I am not matching the tutorial instructions, but all the same, I''ve noted a departure from previous naming conventions. When I go to generate the model ToDo - a model gets created to_do.rb instead of what is expected (by the tutorial) of todo.rb, giving the above error. If I copy to_do.rb to todo.rb it nows finds the model its looking for, but I end up with other problems, further along, with the table names being translated to to_do etc. Can someone put me straight on this? Thanks, Piers Harding. -- http://www.piersharding.com http://search.cpan.org/~piers/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Doug Alcorn
2005-Apr-29 12:21 UTC
Re: Problems with MissingSourceFile in <controller not set>#<action not set> in todo tutorial
Piers Harding <piers-Gn20Leee4l9eoWH0uzbU5w@public.gmane.org> writes:> When I go to generate the model ToDo - a model gets created to_do.rb > instead of what is expected (by the tutorial) of todo.rb, giving the > above error.I haven''t looked at the tutorial for a while; however, I suspect you''re mixing up the case on the model/controller name. When Rails encounters camel case words it splits them up with an underscore. Thus ''./script/generate model ToDo'' will generate app/models/to_do.rb and ''./script/generate model Todo'' will generate app/models/todo.rb. You can''t generate ToDo, rename the file todo.rb and expect it to work. There are lots of places where active record will munge the class name ToDo into to_do. -- doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org
Piers Harding
2005-Apr-29 12:39 UTC
Re: Problems with MissingSourceFile in <controller not set>#<action not set> in todo tutorial
Hi Doug - thanks for the reply - the tutorial went like this: $ ruby script/generate model Todo $ ruby script/generate controller todo So that would tie up with what you are saying. I''ve tried changing all the generate steps to lowercased names, and so far so good. Thanks, Piers Harding. On Fri, Apr 29, 2005 at 08:21:00AM -0400, Doug Alcorn wrote:> Piers Harding <piers-Gn20Leee4l9eoWH0uzbU5w@public.gmane.org> writes: > > > When I go to generate the model ToDo - a model gets created to_do.rb > > instead of what is expected (by the tutorial) of todo.rb, giving the > > above error. > > I haven''t looked at the tutorial for a while; however, I suspect > you''re mixing up the case on the model/controller name. When Rails > encounters camel case words it splits them up with an underscore. > Thus ''./script/generate model ToDo'' will generate app/models/to_do.rb > and ''./script/generate model Todo'' will generate app/models/todo.rb. > You can''t generate ToDo, rename the file todo.rb and expect it to > work. There are lots of places where active record will munge the > class name ToDo into to_do. > -- > doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-- http://www.piersharding.com http://search.cpan.org/~piers/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Steve Clarke
2005-Apr-30 20:23 UTC
Re: Problems with MissingSourceFile in <controller not set>#<action not set> in todo tutorial
>$ ruby script/generate model Todo >$ ruby script/generate controller todo...that reminds me... I''ve seen someone elsewhere mention that you should generate all your controllers with lowercase names. I don''t recall seeing that anywhere in the documentation, so I''m not sure if it''s a requirement or not. I''ve been using camel case for both model and controller without issue, but are there hidden traps that I should be aware of? steve.