SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Beijing
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Windows installation woes

    I have been trying to get Ruby on Rails working on my Windows XP machine for the past two days. I have manage to get the controller working to display pages, however the MySQL connection just refuses to work. I have the following configuration in the database.yml file:

    Code:
    development:
      adapter: mysql
      database: cookbook
      host: localhost
      socket: 
      username: root
      password:
      
    # Warning: The database defined as 'test' will be erased and
    # re-generated from your development database when you run 'rake'.
    # Do not set this db to the same as development or production.
    test:
      adapter: mysql
      database: cookbook
      host: localhost
      socket: 
      username: root
      password:
    
    production:
      adapter: mysql
      database: cookbook
      host: localhost
      socket: 
      username: root
      password:
    And these are the packages I am using:
    Code:
    C:\ruby\cookbook>"c:\ruby\bin\ruby.exe" "c:\ruby\bin\gem" list --local
    
    *** LOCAL GEMS ***
    
    actionmailer (1.1.2, 0.9.1)
        Service layer for easy email delivery and testing.
    
    actionpack (1.10.2, 1.8.1)
        Web-flow and rendering framework putting the VC in MVC.
    
    actionwebservice (0.9.2, 0.7.1)
        Web service support for Action Pack.
    
    activerecord (1.12.2, 1.10.1)
        Implements the ActiveRecord pattern for ORM.
    
    activesupport (1.2.2, 1.0.4)
        Support and utility classes used by the Rails framework.
    
    fxri (0.3.2)
        Graphical interface to the RI documentation, with search engine.
    
    fxruby (1.2.6)
        FXRuby is the Ruby binding to the FOX GUI toolkit.
    
    rails (0.14.2, 0.12.1)
        Web-application framework with template engine, control-flow layer,
        and ORM.
    
    rake (0.6.2)
        Ruby based make-like utility.
    
    sources (0.0.1)
        This package provides download sources for remote gem installation
    The problem I am experiencing is from following the Rolling with Ruby on Rails Tutorial, in the section where you are told to create the following file:

    Code:
    class RecipeController < ApplicationController
      scaffold :recipe
    end
    When I try to access this file on http://cookbook/recipe/, I get the following errror message when accessing the page with IE:

    Code:
    NameError in Recipe#index 
    uninitialized constant Mysql
    RAILS_ROOT: C:/ruby/cookbook/public/../config/..
    
    Application Trace | Framework Trace | Full Trace 
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:198:in `const_missing'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/mysql_adapter.rb:12:in `mysql_connection'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in `connection_without_query_cache='
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/query_cache.rb:54:in `connection='
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:83:in `retrieve_connection'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:241:in `connection'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:517:in `count_by_sql'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:510:in `count'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/pagination.rb:166:in `count_collection_for_pagination'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/pagination.rb:187:in `paginator_and_collection_for'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/pagination.rb:123:in `paginate'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/scaffolding.rb:101:in `list'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/scaffolding.rb:94:in `index'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:834:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:834:in `perform_action_without_filters'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:in `measure'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/rescue.rb:82:in `perform_action'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:365:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:365:in `process_without_session_management_support'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/session_management.rb:116:in `process'
    C:/ruby/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/dispatcher.rb:36:in `dispatch'
    C:/ruby/cookbook/public/dispatch.cgi:10
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:198:in `const_missing'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/mysql_adapter.rb:12:in `mysql_connection'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in `connection_without_query_cache='
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/query_cache.rb:54:in `connection='
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:83:in `retrieve_connection'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:241:in `connection'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:517:in `count_by_sql'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:510:in `count'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/pagination.rb:166:in `count_collection_for_pagination'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/pagination.rb:187:in `paginator_and_collection_for'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/pagination.rb:123:in `paginate'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/scaffolding.rb:101:in `list'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/scaffolding.rb:94:in `index'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:834:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:834:in `perform_action_without_filters'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:in `measure'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/rescue.rb:82:in `perform_action'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:365:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:365:in `process_without_session_management_support'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/session_management.rb:116:in `process'
    C:/ruby/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/dispatcher.rb:36:in `dispatch'
    C:/ruby/cookbook/public/dispatch.cgi:10
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:198:in `const_missing'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/mysql_adapter.rb:12:in `mysql_connection'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:120:in `connection_without_query_cache='
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/query_cache.rb:54:in `connection='
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:83:in `retrieve_connection'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:241:in `connection'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:517:in `count_by_sql'
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.12.2/lib/active_record/base.rb:510:in `count'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/pagination.rb:166:in `count_collection_for_pagination'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/pagination.rb:187:in `paginator_and_collection_for'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/pagination.rb:123:in `paginate'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/scaffolding.rb:101:in `list'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/scaffolding.rb:94:in `index'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:834:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:834:in `perform_action_without_filters'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:in `measure'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/rescue.rb:82:in `perform_action'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:365:in `send'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/base.rb:365:in `process_without_session_management_support'
    C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/session_management.rb:116:in `process'
    C:/ruby/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/dispatcher.rb:36:in `dispatch'
    C:/ruby/cookbook/public/dispatch.cgi:10
    This error occured while loading the following files:
       mysql.rb
    Request
    Parameters: None
    
    Show session dump
    
    --- 
    flash: !ruby/hash:ActionController::Flash::FlashHash {}
    Response
    Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}
    I've searched far and wide on Google, but have not found a solution to this problem yet. Has anybody experienced this problem before? Any idea what the problem is? I am using MySQL v4.0.18.

    Thanks,
    Phil

  2. #2
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You haven't installed the Ruby/MySQL bindings. There are two sets...binding written in Ruby and bindings written in C. The C bindings will be faster but I do not have experience installing either on a Windows box.

    This should help:
    http://wiki.rubyonrails.com/rails/pages/MySQL

  3. #3
    SitePoint Member
    Join Date
    Sep 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used the pure ruby bindings and they do work on win32. Performance is pretty painful, but I'm just using it for development.
    http://www.tmtm.org/en/ruby/mysql/README_en.html

    but this guy has managed to compile the C bindings for win32:
    http://wiki.rubyonrails.com/rails/pa...indingsOnWin32

    Some people see 10x performance increase with the C bindings so I would recommend trying that first.

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Beijing
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help. It seems that the Win32 bindings do not work with MySQL 4.0. Never mind, I'm switching to Fedora Core now to play around with Ruby on Rails - it works fine on Linux.


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
  •