DISQUS

Vision Master Designs: Tutorial : Developing your First Ruby on Rails 2 Application

  • tyler · 1 year ago
    Hi, I get an error #42000 when i rake db:migrate, unknown database "articlesystem_developemnt" I can manually add the database, but is there another way around that? thanks, great tutorials by the way.

    tyler
  • Kenneth · 5 months ago
    when i rake db:migrate, unknown database “articlesystem_development” I can manually add the database....

    Same problem here!
    rest of the tutorial works perfect
  • Michael · 1 year ago
    Hey Tyler,
    Sorry for the delay in replying, do one thing,

    The is the database must exist prior to raking. then using rake db:migrate automatically creates the tables.

    You can follow this method as well

    create a application simply
    "rails appname"

    then edit the "database.yml" folder inside your app/config

    replace the code with the following code.

    development:
    host: localhost
    adapter: mysql
    database: put the database you want to use
    username: put your db username
    password: put your db pass

    After this, see to it that the database exists in mysql either you

    then follow with creating a scaffold and then raking it. It should work fine now.

    I`ll add it to the tutorial as well. Thanks
    Regards
  • tyler · 1 year ago
    perfect works great.

    thanks!
  • Michael · 1 year ago
    :)
  • Tom Glenn · 1 year ago
    Awesome! I have only just started looking into developing using Rails (Im a PHPer) and the development speed is very impressive!
  • marc · 1 year ago
    Looks like a good tutorial but I get the following error when performing the "ruby script/server" command, any ideas?

    C:\ruby\bin\articles>ruby script/server
    => Booting WEBrick...
    => Rails 2.1.0 application started on http://0.0.0.0:3000
    => Ctrl-C to shutdown server; call with --help for options
    [2008-08-28 12:29:21] INFO WEBrick 1.3.1
    [2008-08-28 12:29:21] INFO ruby 1.8.6 (2007-09-24) [i386-mswin32]
    [2008-08-28 12:29:21] WARN TCPServer Error: Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2)
    C:/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2)
    (Errno::EADDRINUSE)
    from C:/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `new'
    from C:/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners'
    from C:/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `each'
    from C:/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners'
    from C:/ruby/lib/ruby/1.8/webrick/server.rb:75:in `listen'
    from C:/ruby/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
    from C:/ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
    from C:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/webrick_server.rb:58:in `new'
    ... 7 levels...
    from C:/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
    from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
    from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    from script/server:3


    When I try to visit http://localhost:3000/articles I get a 404 error.....

    ?
  • marc · 1 year ago
    Found the problem.

    I installed ruby on xampp and it didnt like it.

    Solution was to unistall ruby then reinstall ruby and recreate the site outside of the xampp folder.

    Added the following to httpd.conf:

    Listen 3000
    LoadModule rewrite_module modules/mod_rewrite.so
    #################################
    # RUBY SETUP
    #################################

    ServerName rails
    DocumentRoot "c:/ruby/bin/articlesystem/public"


    Options ExecCGI FollowSymLinks
    AllowOverride all
    Allow from all
    Order allow,deny
    AddHandler cgi-script .cgi
    AddHandler fastcgi-script .fcgi



    #################################
    # RUBY SETUP
    #################################
  • wely · 1 year ago
    finally, an updated tutorial. thanks! keep it coming. =)
  • Gaetano · 1 year ago
    you can create the database without typing the following command
    mysql>CREATE DATABASE databasename \g
    simply editing the file database.yml and running the command
    rake db:create:all
    Rails 2.0 will create three databases development, test and production
  • jab · 1 year ago
    hi
    during db:migrate , there was an error occured. it said

    Mysql::Error: Commands out of sync; you can't run this command now: SHOW TABLES

    but then the tables were created succesfully. and my articlesystem went up just fine.but then when i tried creating a new article.then i cliked create.and i get this error

    ArgumentError in ArticlesController#show
    NULL pointer give
    app/controllers/articles_controller.rb:16:in `show'

    what could hav been the problem.pls help.
  • Sven · 1 year ago
    @jab
    Hi Jab,
    I run into the same problem. Have you find a solution for this issue yet?
  • David · 11 months ago
    Hi,
    I got the same problem everytime I run db:migrate command. The solution that I've found is to change my mysql server. I was using 5.1 version and now I'm using 5.0.67.

    note: I use 2.7.3 mysql gem driver

    Bye and happy new year!!
    David
  • Luis Jaramillo · 11 months ago
    @David
    Hi David,
    I have the same problem, David are you sure the solution is to change the version of MYSQL? or by making something extra.
    Please confirm me to make changes and solve this problem.
    thanks.
    Luis Jaramillo
  • David · 11 months ago
    @Luis Jaramillo

    Hi Luis,

    I didn't make anything extra. I just changed MYSQL from 5.1 to 5.0.67 and It worked. Mysql gem driver version was 2.7.3. In my case, I didn´t have any previous application running, I mean, the problem didn't appear after an updating of my application. I just tested a "hello world" RoR application. The easiest way. I say this because you could have your app running with several tables in your database and the version change could be not so easy. If you already have your 5.1 database running with content, try to test 5.0.67 database separately.

    Saludos,
    David
  • Arno · 11 months ago
    @David

    Hi all,
    I have exactly the same problem - although I've exactly these versions: MYSQL 5.0.67 and mysql-gemdriver version 2.7.3.

    >rake db:migrate --trace
    (in C:/ruby/projects/CM)
    ** Invoke db:migrate (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    ** Execute db:migrate
    == CreatePeople: migrating ===================================================
    -- create_table(:people)
    -> 0.1100s
    == CreatePeople: migrated (0.1100s) ==========================================

    ** Invoke db:schema:dump (first_time)
    ** Invoke environment
    ** Execute db:schema:dump
    rake aborted!
    Mysql::Error: Commands out of sync; you can't run this command now: SHOW TABLES

    When doing ANY KIND OF DATABASE ops, the Mongrel- and WebBrick-Servers crash with Segmentation Faults. I've already googled for days, but still no idea for a solution.

    PLEASE HELP..

    Ciao,
    Arno
  • Jaime Barragan · 9 months ago
    Hi All,
    I was having the same problem and the following post help me to fix it. http://forums.aptana.com/viewtopic.php?f=20&...
    I think the problem is the libmysql.dll client library version, I mean, if you have libmysql.dll in your path or you copied to \bin from directory, you ended up with a libmysql.dll client 5.1.X You can fix the problem without installing a new server by replacing libmysql.dll client 5.0.X. I got mine from php installation.
    I hope this helps,

    Saludos,

    Jaime
  • Mabidoli · 8 months ago
    Jaime, that really worked, I was having the same
    problem.

    Thanks,
  • James · 6 months ago
    Replacing the libmySQL.dll from a MySQL 5.1 installation with one from a 5.0 version, downloaded directly from www.mysql.com worked perfectly. I can't believe it! sooooo many hiccups trying to get rails running well on an XP machine. Looks like progress! thanks...
  • Dave · 6 months ago
    "Help+Dumbness=? (required)"
    Where could i get a demo of this?
    _____________________________________________
    "Meaning of life-Mew=? (required)"
  • Michael · 6 months ago
    Actually Dave, there is no demo of this particular tutorial since it is very simple. If you have any problems you can always ask :)
  • Ruby · 5 months ago
    It would be allot of help if you can upload the files for a demo?
    I think HostGator (VisionMasterDesigns Web host) will support Ruby on rails
  • Dave · 5 months ago
    Thanks for the tutorial i have 2 questions
    How do you custimise the page? (e.g. the page where yoou view the news article).

    Is ROR better then PHP?