Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChris Johnson
15,048 PointsRuby on Rails with Microsoft Sql server database
Hi,
I am still new to Ruby and Rails and I was wondering if anyone has used the activerecord-sqlserver-adapter to connect their rails project to a microsoft sql server. I am having alot of issues and I was hoping for an easy solution or at least some steps to get me in the right direction. My main goal is that I want to host a rails project on a windows server using microsoft sql server. I dont know how to connect my project to MSSQL I dont know how to host a rails app for production on my own server Any help would be greatly appreciated!
Thanks
1 Answer
miguelcastro2
Courses Plus Student 6,573 PointsHate to disappoint you, but there are no easy solutions for using Rails on a Windows platform. It was not designed to run on Windows and I don't think I would recommend Windows as a platform for a Rails app. Not to say it hasn't been done, but in my experience it would be far easier to setup and run on a Linux platform as it was designed to do.
There is support for MS SQL server and Rails and you can checkout this project for more information. My recommendation is to learn more about Rails and setting it up the environment, because a red flag to me is that you want to deploy a Rails app and yet do not know how to set it for production. This should be Rails 101 knowledge. Production is just another environment for Rails, there are things you need to be aware of when running a Rails app in production and this information can be found on easily rubyonrails.org.
Put some more time into learning Rails and perhaps setup a Linux virtual machine, deploy your Rails app, and experiment. Once you learn how to deploy Rails on a Linux platform them perhaps it may be a little easier to understand how to go about doing it on Windows.
Chris Johnson
15,048 PointsChris Johnson
15,048 PointsHi thanks for your comment, For the project listed I have been going through that quite a lot and I am really not understanding what is required for the database.yml file? In general if you started a new rails project with the sql server adapter setup all you really need to do is configure the database.yml file for the connections and thats where I am failing. Yes I know Windows is not the best environment to be running a rails application. I was planning on setting up a virtual linux box and hosting the project there inside the windows server. I am still learning and reading all I can to learn more about ruby and rails.
miguelcastro2
Courses Plus Student 6,573 Pointsmiguelcastro2
Courses Plus Student 6,573 PointsYou should be able to just setup the database.yml file with the proper server information and login credentials. This is an example for SQL Server using the ActiveRecord SQL Server adapter:
If you are experiencing problems then try checking your log files in the log directory. You should see one for your development environment called development.log.
If it is still giving you problems then perhaps switch to MySQL temporarily to allow you an opportunity to get your rails environment working so you can continue learning.
Chris Johnson
15,048 PointsChris Johnson
15,048 PointsThanks for all of your help. Yeah I have been using MySQL and I like it alot better. I was trying to do a specific project that required MSSQL and it has been really challenging being new to ruby and rails. Thanks again!