error: Undefined method 'path' on script/generate
I am a professional Windows developer just starting to learn Rails. I am following through the Wrox book Ruby on Rails for Microsoft Developers. I have taken the following steps to set up my machine (Vista):
- run installer for Ruby 1.9.2p0
- insta开发者_如何转开发ll the development kit
- install Rails 2.2.2 (this is the version used in the book)
- install Mongrel
- install Sqlite3 and Sqlite3-ruby
At the end of the introductory first chapter, the author has you run a few commands as a demonstration of what Rails can do:
- rails addressbook
- cd addressbook
- ruby script/generate scaffold person name:string address:string phone:string email:string blog:string
That last command generates the following error:
- undefined method 'path' for class 'ActionController::UploadedStringIO' (NameError)I spent pretty much all day yesterday troubleshooting this and have no progress to show for it. Your input is greatly appreciated.
I can't solve your problem, but I'll point out you're using a very recent version of Ruby with a quite old version of Rails. That's likely the cause of the issues you're running into. Try installing an older version of ruby and see if that solves your problems.
If you' like to learn rails, I humbly suggest you learn Rails 3 (i.e. the latest version of the framework, which will support the recent versions of Ruby).
Two excellent resources:
- http://railstutorial.org/ruby-on-rails-tutorial-book available online free of charge (along with eBook and screencasts for sale)
- my personal favorite http://pragprog.com/titles/rails4/agile-web-development-with-rails
Rails 3 has really brought a ton of great features (as well as deprecating others), so you're really doing yourself a disservice by learning Rails 2.
In addition, the two resources above explain things clearly enough that you won't be held back by the lack of comparisons to Microsoft frameworks.
精彩评论