SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict sporkit's Avatar
    Join Date
    Jan 2003
    Location
    DeKalb, IL
    Posts
    290
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Generating Model Errors Out

    PHP Code:
    asdf@sporkit.com-> script/generate model TestThing -t
          exists  app
    /models/
          
    exists  test/unit/
          
    exists  test/fixtures/
       
    identical  app/models/test_thing.rb
       identical  test
    /unit/test_thing_test.rb
       identical  test
    /fixtures/test_things.yml
          exists  db
    /migrate
    uninitialized constant Rails
    ::Generator::Commands::Base::ActiveRecord
      
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:493:in `const_missing_before_generators'
      /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/lookup.rb:15:in 
    `const_missing'
      /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/commands.rb:84:in `next_migration_string'
      
    /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/commands.rb:361:in `migration_template'
      /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/manifest.rb:47:in 
    `send'
      /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/manifest.rb:47:in `send_actions'
      
    /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/manifest.rb:46:in `each'
      /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/manifest.rb:46:in 
    `send_actions'
      /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/manifest.rb:31:in `replay'
      
    /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/commands.rb:42:in `invoke!'
      /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/rails_generator/scripts/../scripts.rb:31:in 
    `run'
      /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/commands/generate.rb:6
      /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
      
    /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
      script/generate:3 
    Brand new to this and reading right out of the Apress book. Things seem to go fine but my migration file is never created. Where do I begin to hunt this issue down? No table was created in my db either.

  2. #2
    SitePoint Addict
    Join Date
    Feb 2007
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Almost seems there's something wrong with your rails installation.

    I'm just shooting in the dark, here, but I'd try "-ft" for the switches, which will clear out the "identical" messages, but I'd also check the output from "script/generate model" by itself to make sure that works and also "script/generate model TestThing name:string" just to see if they gave me more information.

    There was a bug in the generators for Rails 2.1.2, but I don't recall it exhibiting this particular error message. Do you have control over the gems and the rails versions?

  3. #3
    SitePoint Addict sporkit's Avatar
    Join Date
    Jan 2003
    Location
    DeKalb, IL
    Posts
    290
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tried a few things...

    Upgrading activerecord, mysql, and rails with "gem install asdf". Then even tried "gem install rubygems-update" and ran "rubygems-update"

    Still no luck. I'm pretty sure it's an installation issue.

  4. #4
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Recent versions of Rails require you to install the mysql gem. In older versions of Rails, MySQL support was installed by default. Most Rails books were written before this change so don't include the requirement to install the mysql gem. Try doing a:

    gem install mysql

    However, note that if you are running on XP, there can be problems with this gem and certain versions of MySQL. See this thread:

    http://www.sitepoint.com/forums/showthread.php?t=605682

  5. #5
    SitePoint Addict sporkit's Avatar
    Join Date
    Jan 2003
    Location
    DeKalb, IL
    Posts
    290
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still chasing down this error.

    • Reinstalled Ruby
    • Updated RubyGems
    • Reinstalled Rails gem

    Trying to install the mysql gem I encounter what I believe is the same error.

    Code:
    /usr/local/bin/ruby extconf.rb install mysql
    checking for mysql_query() in -lmysqlclient... yes
    checking for mysql_ssl_set()... yes
    checking for mysql.h... no
    checking for mysql/mysql.h... yes
    creating Makefile
    
    make
    gcc -I. -I/usr/local/include/ruby-1.9.1/i386-freebsd6.1 -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_MYSQL_H -I/usr/local/include    -fPIC  -O2 -g -Wall -Wno-parentheses -omysql.o -c mysql.c
    mysql.c:6:21: version.h: No such file or directory
    mysql.c: In function `make_field_obj':
    mysql.c:185: warning: unused variable `hash'
    mysql.c: In function `escape_string':
    mysql.c:267: error: structure has no member named `len'
    mysql.c:268: error: structure has no member named `len'
    mysql.c:268: error: structure has no member named `ptr'
    mysql.c:268: error: structure has no member named `ptr'
    mysql.c:268: error: structure has no member named `len'
    mysql.c: In function `real_escape_string':
    mysql.c:401: error: structure has no member named `len'
    mysql.c:402: error: structure has no member named `len'
    mysql.c:402: error: structure has no member named `ptr'
    mysql.c:402: error: structure has no member named `ptr'
    mysql.c:402: error: structure has no member named `len'
    mysql.c: In function `query':
    mysql.c:710: error: structure has no member named `ptr'
    mysql.c:710: error: structure has no member named `len'
    mysql.c:729: error: structure has no member named `ptr'
    mysql.c:729: error: structure has no member named `len'
    mysql.c: In function `query_with_result_set':
    mysql.c:882: warning: implicit declaration of function `TypeError'
    mysql.c: In function `fetch_field_direct':
    mysql.c:960: warning: implicit declaration of function `Raise'
    mysql.c: In function `fetch_hash2':
    mysql.c:1032: error: structure has no member named `ptr'
    mysql.c:1033: error: structure has no member named `ptr'
    mysql.c: In function `field_inspect':
    mysql.c:1157: error: structure has no member named `len'
    mysql.c:1158: error: structure has no member named `ptr'
    mysql.c:1158: error: structure has no member named `ptr'
    mysql.c: In function `stmt_bind_result':
    mysql.c:1284: error: structure has no member named `ptr'
    mysql.c: In function `stmt_execute':
    mysql.c:1346: error: structure has no member named `ptr'
    mysql.c:1347: error: structure has no member named `len'
    mysql.c:1348: error: structure has no member named `len'
    mysql.c:1359: error: structure has no member named `ptr'
    mysql.c:1360: error: structure has no member named `ptr'
    mysql.c:1361: error: structure has no member named `ptr'
    mysql.c:1362: error: structure has no member named `ptr'
    mysql.c:1363: error: structure has no member named `ptr'
    mysql.c:1364: error: structure has no member named `ptr'
    mysql.c:1316: warning: unused variable `false'
    mysql.c: In function `stmt_prepare':
    mysql.c:1584: error: structure has no member named `ptr'
    mysql.c:1584: error: structure has no member named `len'
    *** Error code 1
    
    Stop in /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.7.
    I suppose the first issue is version.h hasn't been created. Even after I installed ruby again.


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
  •