SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot crunch42's Avatar
    Join Date
    Jun 2003
    Location
    San Francisco
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ruby script/generate scaffold Product Admin HANGS

    Following the instructions in the "Agive Web Development with Rails" book on page 57 for a program called "Depot". I enter the command "ruby script/generate scaffold Product Admin" in the shell, and it hangs on the line "create test/fixtures/products.yml". If I ctrl-c it I get:

    Code:
    ^C/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/vendor/mysql.rb:1079:in `read': Interrupt
            from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/vendor/mysql.rb:1079:in `read'
            from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/vendor/mysql.rb:499:in `read'
            from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/vendor/mysql.rb:492:in `command'
            from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/vendor/mysql.rb:339:in `stat'
            from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:147:in `active?'
            from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:103:in `retrieve_connection'
            from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in `connection'
            from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:107:in `retrieve_connection'
             ... 20 levels...
            from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__'
            from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
            from /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in `require'
            from script/generate:3
    Any ideas? Anyone had this happen and figured it out? I'm using OS X 1.4 Tiger and have followed the instructions at http://tech.rufy.com/entry/46 (with Xcode installed), but same problem persists.

    Thanks,
    Julian

  2. #2
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've not had this problem, but my best guess:

    When you do script/generate scaffold, Rails will query your database so that it can create views (.rhtml files). In your trace, it looks like you are getting stuck in the mysql adapter, that's the bit that talks to the database.

    Do you know if Rails can talk to the database? Can you access the database with CocoaMySQL?

    If you don't know, try creating the model (./script/generate model Product) and then try accessing using the console (./script/console then Prodcut.new or Product.find :all) and see if that works.

    Not a solution, but might help finding out what the problem is

    Douglas
    Hello World

  3. #3
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Someone I know was having a problem a lot like this on OSX 10.4. The solution ended up being to upgrade from MySQL 4.0.12 to MySQL 4.1.

    The effort spent in that process isn't exactly wasted even if it is not the cause of the problem, so it may be a good thing to try once more obvious solutions (getting database.yml set correctly, etc) fail.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  4. #4
    SitePoint Zealot crunch42's Avatar
    Join Date
    Jun 2003
    Location
    San Francisco
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I think I got it fixed.

    I ran the script at http://tech.rufy.com/entry/46 which fixes Ruby issues in Tiger, then I reinstalled the MySQL gem:

    Code:
    sudo gem install mysql -- --with-mysql-include=/usr/local/mysql/include/ with-mysql-lib=/usr/local/mysql/lib/
    Then I made sure my config/database.yml file had the right connection settings, and that my database table had been created (I used YourSQL), shut down and restarted script/server, then it seems to work!

    My system is running OS X 10.4.3, Ruby 1.8.2, Rails 1.0, and MySQL 5.0.15


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •