Server: rails

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 960 Views - Last Post: 17 May 2011 - 07:54 PM Rate Topic: -----

#1 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Server: rails

Posted 15 May 2011 - 11:00 AM

Is it alright to use my currently installed server apache or will i have to use another type of server?
Is This A Good Question/Topic? 0
  • +

Replies To: Server: rails

#2 nimajneb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 116
  • Joined: 04-August 10

Re: Server: rails

Posted 15 May 2011 - 11:12 AM

You can certainly use Apache. I use it for production releases. The best way to do this is using Passenger: http://www.modrails.com/

If you're just wanting to test or dev, Rails works out of the box with WEBrick.
Was This Post Helpful? 0
  • +
  • -

#3 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Server: rails

Posted 15 May 2011 - 11:17 AM

View Postnimajneb, on 15 May 2011 - 11:12 AM, said:

You can certainly use Apache. I use it for production releases. The best way to do this is using Passenger: http://www.modrails.com/

If you're just wanting to test or dev, Rails works out of the box with WEBrick.


Alright thank you now i have one more question in my database.yml file it says its using sqlite3 is it possible for me to configure it to use MySQL and if so could you show me how? Sorry litterally my first day with rails and a week into ruby currently :)
Was This Post Helpful? 0
  • +
  • -

#4 nimajneb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 116
  • Joined: 04-August 10

Re: Server: rails

Posted 15 May 2011 - 11:41 AM

No problem. First things first, make sure you get and require the mysql gem

sudo gem install mysql


then make sure you add it to your gemfile:

gem 'mysql'


your database.yml should look something like this:

development:
  adapter: mysql
  database: rails_dev
  username: root
  password: your password




That's the quick and dirty way.
Was This Post Helpful? 0
  • +
  • -

#5 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Server: rails

Posted 15 May 2011 - 11:43 AM

View Postnimajneb, on 15 May 2011 - 11:41 AM, said:

No problem. First things first, make sure you get and require the mysql gem

sudo gem install mysql


then make sure you add it to your gemfile:

gem 'mysql'


your database.yml should look something like this:

development:
  adapter: mysql
  database: rails_dev
  username: root
  password: your password




That's the quick and dirty way.

To use the gem install mysql do i have to be in a certain directory?
Was This Post Helpful? 0
  • +
  • -

#6 nimajneb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 116
  • Joined: 04-August 10

Re: Server: rails

Posted 15 May 2011 - 11:46 AM

View PostSadin56, on 15 May 2011 - 10:17 AM, said:

[ Sorry litterally my first day with rails and a week into ruby currently :)


If you're just starting with Rails, you might want to start with the out of the box database (sqlite) and webserver(WEBrick) It's easier to use and you don't have to fuss with as much. You don't have to play with any settings.

View PostSadin56, on 15 May 2011 - 10:43 AM, said:

To use the gem install mysql do i have to be in a certain directory?


Just be in the root directory of your rails project
Was This Post Helpful? 0
  • +
  • -

#7 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Server: rails

Posted 15 May 2011 - 11:49 AM

ok i will. the mysql is killing me because its giving me errors when i try to install it.

ERROR:  Error installing mysql:
	ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
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... no
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... yes
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.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/bin/ruby1.8
	--with-mysql-config
	--without-mysql-config
	--with-mysql-dir
	--without-mysql-dir
	--with-mysql-include
	--without-mysql-include=${mysql-dir}/include
	--with-mysql-lib
	--without-mysql-lib=${mysql-dir}/lib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-mlib
	--without-mlib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-zlib
	--without-zlib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-socketlib
	--without-socketlib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-nsllib
	--without-nsllib
	--with-mysqlclientlib
	--without-mysqlclientlib
	--with-mygcclib
	--without-mygcclib
	--with-mysqlclientlib
	--without-mysqlclientlib


Gem files will remain installed in /var/lib/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out


i dont know what im doing wrong :/
Was This Post Helpful? 0
  • +
  • -

#8 nimajneb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 116
  • Joined: 04-August 10

Re: Server: rails

Posted 15 May 2011 - 11:57 AM

You need to set a path for your mysql directory:

gem install mysql -- --with-mysql-dir=path_to_mysql

Was This Post Helpful? 1
  • +
  • -

#9 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Server: rails

Posted 15 May 2011 - 11:58 AM

thanks a bunch :D
Was This Post Helpful? 0
  • +
  • -

#10 nimajneb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 116
  • Joined: 04-August 10

Re: Server: rails

Posted 15 May 2011 - 12:00 PM

View PostSadin56, on 15 May 2011 - 10:58 AM, said:

thanks a bunch :D


No problem. Also, you should think about upgrading to Ruby 1.9 ;)
Was This Post Helpful? 0
  • +
  • -

#11 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Server: rails

Posted 15 May 2011 - 12:05 PM

im using 1.9 :o
Was This Post Helpful? 0
  • +
  • -

#12 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Server: rails

Posted 15 May 2011 - 01:34 PM

Hey thanks again very much you helped me get over the only speedbump i had in getting ruby and rails setup on my development laptop. Its so much simpler on linux then windows :)
Was This Post Helpful? 0
  • +
  • -

#13 MitkOK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 32
  • View blog
  • Posts: 403
  • Joined: 09-August 07

Re: Server: rails

Posted 15 May 2011 - 02:30 PM

If you have already generated an app:

In Gemfile:

gem 'mysql2'

Then just run bundle install ( $ bundle install )

If you're starting new app:
$ rails new app_name -d mysql

This will generate app with mysql configuration.
Rails will use mysql2 gem which is libmysql binding and it's faster.

This post has been edited by MitkOK: 15 May 2011 - 02:33 PM

Was This Post Helpful? 2
  • +
  • -

#14 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Server: rails

Posted 15 May 2011 - 03:52 PM

where is the gemfile?
Was This Post Helpful? 0
  • +
  • -

#15 MitkOK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 32
  • View blog
  • Posts: 403
  • Joined: 09-August 07

Re: Server: rails

Posted 17 May 2011 - 01:57 AM

View PostSadin56, on 16 May 2011 - 01:52 AM, said:

where is the gemfile?

Really ? Dude, sit on your butt and read some book for absolute beginners on OS and stuff.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2