1

I'm fairly new to the Rails game; I'm a front-end dev teaching myself to program. I've built a web application and decided to use the RailsKit SaaS kit to handle my registrations and such. I'm having problems just getting the default app up and running, but I'm sure it's due to my lack of knowledge and I think it has to do with getting a mysql server set up (usually I use sqlite3, but that doesn't seem to work w/ this app either).

Here's the process and errors that I've come across, and I still can't even create a db or start the server...

  1. Downloaded the app

  2. Ran bundle install. Got the following error:

    Gem::InstallError: factory_girl requires Ruby version >= 1.9.2. 
    An error occurred while installing factory_girl (4.1.0), and Bundler cannot continue.
    Make sure that `gem install factory_girl -v '4.1.0'` succeeds before bundling.
    
  3. Found out I was running on Ruby version 1.8.7, so I added this to the Gemfile:

    gem 'rake','1.9.2' and **updated my system** to 1.9.2
    
  4. Ran bundle install and got the following error:

    An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
    Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
    
  5. So I ran gem install mysql2 -v '0.3.11 and got the following error:

    ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.
    
    /Users/trevanhetzel/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
    checking for rb_thread_blocking_region()... yes
    checking for rb_wait_for_single_fd()... yes
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lm... yes
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lz... yes
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lsocket... no
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lnsl... no
    checking for mysql_query() in -lmysqlclient... no
    checking for main() in -lmygcc... no
    checking for mysql_query() in -lmysqlclient... no
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.  Check the mkmf.log file for more details.  You may need configuration options.
    

So that's where I am. If this helps, after all the steps above, I tried to create a db by rake db:create and got

Could not find gem 'mysql2 (>= 0) ruby' in the gems available on this machine.

So I'm guessing MySQL is not installed on my machine? Seems kinda odd cause I use MAMP all the time w/ a MySQL server.

Any help pointing me in the right direction would be great guys! I really appreciate it.

Trevan Hetzel
  • 1,371
  • 7
  • 21
  • 42
  • which OS are you using? For OSX see this answer: http://stackoverflow.com/questions/4115126/ruby-gem-mysql2-install-failing – doesterr Nov 24 '12 at 02:39
  • OSX. I got past this though and can now start the server. I just get this error when migrating: 'Trevan-Hetzels-MacBook-Pro:V4 trevanhetzel$ rake db:create db:migrate saas:bootstrap rake aborted! undefined method `trial_interval' for # /Users/trevanhetzel/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:407:in `method_missing' /Users/trevanhetzel/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.8/lib/active_record/attribute_methods.rb:149:in'... – Trevan Hetzel Nov 24 '12 at 03:00
  • This problem was due to a missing field in the migration supplied with the Kit. This has been fixed. :) – Benjamin Curtis Nov 25 '12 at 00:09
  • @BenjaminCurtis Oh okay. Still getting an error when migrating: ```Trevan-Hetzels-MacBook-Pro:V4 trevanhetzel$ rake db:migrate rake aborted! undefined local variable or method `config' for main:Object /Sidecar/V4/config/application.rb:3 /Sidecar/V4/Rakefile:4 (See full trace by running task with --trace)``` and can't start the server. Do I need to do anything else? – Trevan Hetzel Nov 25 '12 at 03:27
  • @BenjaminCurtis Nevermind, that was due to me adding ```config.assets.paths += ["app/assets/public"]``` to ```application.rb```. I can now start the server but still encounter the above error about the undefined 'trial_interval' method. – Trevan Hetzel Nov 25 '12 at 03:30
  • I'm late to this question, but more recent versions os sass-kit (3.0.4) use sqlite and wouldn't require mysql2. Did you ever get it working? I'd also highly recommend using rvm or rbenv, targeting ruby 2.0 and rails 4.1.1 for new apps. – Archonic Sep 10 '14 at 19:14

2 Answers2

0

bundle exec rake db:migrate it sounds like.

pjammer
  • 9,489
  • 5
  • 46
  • 56
  • 'bundle exec rake db:migrate' gives me this now: /Library/Ruby/Gems/1.8/gems/saas-kit-2.5.4/lib/saas/extensions/active_merchant/billing/gateways/paypal.rb:31: warning: already initialized constant RECURRING_ACTIONS /Library/Ruby/Gems/1.8/gems/saas-kit-2.5.4/lib/saas/extensions/active_merchant/billing/gateways/paypal_express_recurring.rb:12: warning: already initialized constant LIVE_REDIRECT_URL /Library/Ruby/Gems/1.8/gems/saas-kit-2.5.4/lib/saas/extensions/active_merchant/billing/gateways/paypal_express_recurring.rb:13: warning: already initialized constant TEST_REDIRECT_URL – Trevan Hetzel Nov 24 '12 at 03:04
  • can you access console by using `bundle exec rails c`... you shouldn't see an error, but like a flashing cursor and maybe the 1> or something like that. Also, `mysql -u root` to see if mysql is on your machine. And you picked a nice meaty topic to pick for your first go around bro :-) – pjammer Nov 24 '12 at 03:06
  • Yeah I can access the console. `mysql -u root` gives me a command not found, so it's obviously not on my machine. I think I'm gonna stick with sqlite3 though, since it's working (other than the error above). And I know, right? I tend to learn by throwing myself headfirst in crazy crap and trying to swim out of it :) – Trevan Hetzel Nov 24 '12 at 03:24
0

Before installing mysql2 gem you need to install mysql client and server in your system. So try this.

  $sudo apt-get update
  $sudo apt-get install mysql-server mysql-client

After this try to install gem mysql2

dealer
  • 474
  • 3
  • 8