how to use rails databases? guide? - ruby-on-rails

I am having some trouble understanding how to use databases with ruby on rails. I know that my app works fine when i generate a scaffold and add/edit models. What i do not understand is if anything changes when i put my rails app online, does it still use the .sqlite3 file in the db folder? or do i connect it to my sites SQL server?
If you do switch and connect to a SQL server why is this?
Is there a guide or tutorial on this topic that you can point me to perhaps? my searching mostly came up with migrating tutorials. I just want to figure out how Rails works when it is live on a website.
Thanks

You can use SQLite on production with no problems, although it is not the ideal option.
On production is more recommendable to use a more powerful solution. You can see at the official guide how to switch: http://guides.rubyonrails.org/getting_started.html#configuring-a-database

Related

Can I use my web server to host my rails application?

I have now build my first Ruby on Rails site and I want to publish/deploy/show it to the world on internet. I have access to space on a web server trough a university that I am associated with. But after some searching I realized that publishing a Rails site is slightly more complicated than publishing a regular html production.
Is there any way to use the space I have? How can I know if the server I have access to is up for the task? Is there any guides on how to do this via SSH or git or whatever? I have search a lot but not found anything useful. It doesn't have to be easy, I just have to work. And it's good if I can learn and understand what I am doing.
I have tried quite extensively to make it work with Heroku (everybody claims it to be so easy) but failed since it will not accept my push. Probably because I use Rails 4.2.2 (I don't want to change this, too many things stopped working when I tried to update) and Paperclip which seems to be known issues.
Please, I'm getting desperate, any help pointing in the right direction is very appreciated.

Can we connect to multiple database connections after the Application has been deployed to production on Rails?

I am new to Rails and need some help on this!
Can we connect to a local database and production database simultaneously after the project has been deployed to production ??
for example : My application when deployed to production, with a click of a button on the page, it should toggle between the usage of production database and the user's local database.Is that possible ?
Thanks!
You can do this, there are some clues in the comments here:
ActiveRecord/Base/connection
ActiveRecord/Base/establish_connection/class
Useful explanation of establish_connection
And a more comprehensive guide here:
dynamic-database-switching-rails-how-to-do-it
But it's a bit of a faff - why do you need to do this, maybe there is another way to achieve what you want?

How to start developing Ruby on Rails applications with heroku?

What is the best way to get familiar with the heroku environment? What are the first steps? I want to start programming with it next week, using Ruby on Rails.
If you want to get started on ruby on rails using Heroku one of the best things you can do is actually work through the Rails tutorial. It is designed and written with Heroku (and Git which you will be using to deploy) in mind. You can check it out at http://ruby.railstutorial.org/ruby-on-rails-tutorial-book.
I don't know if you already know Ruby or not, but the tutorial is designed in such a way that you don't actually need to know Ruby to follow it.
One very nice thing (among many) about Heroku is that they maintain solid documentation. Specifically for your question, you should start with Getting Started with Heroku.

Flex and Ruby on Rails start up

I'm new at Ruby on Rails, but already developed a start project.
Now I figure out that I have to use flash for it, and the best way as I see is Flex.
The problem is that I didn't find no start up guide how to combine these two things. Should I use RubyAMF or WebORB? or both? And will such combination will work fine on Heroku cloud?
For sum up, I'm Looking for some basic info or a short guide for combining RoR and Flex.
Well, here is a really good book on the subject: "Flexible Rails". It has a ton of good info for the combo.
For me, I have done this with a lot of success. I use RoR to develop my RESTfull service and I put the Flex app in the public folder of the Rails app. Of course, an Air app can connect to the service the same way.
I then publish the app using Heroku. The entire end-to-end story is quite solid... assuming, of course, that a Flex-based web app is what you want. I also like a HTML/Coffeescript/Backbone client that does the same thing... but that is a different story all together :)
Good luck. This is certainly a fun combo to be developing with.

Rails mail tutorial, along with the required settings

I'm new to RoR, writing a simple app. Need to implement mail functionality the usual register/forgot password stuff. I have googled, but haven't got a complete tutorial yet. Most of the tutorials teach how to send mail, but don't help out with the settings. can someone suggest a good tutorial, complete with settings?
I'm on ubuntu 9.04, would like to use my dev box as the server.
I'm just starting using Ruby on Rails and am using Ubuntu too.
From my research, I've found http://modrails.com/ is the best solution to host rails on ubuntu / apache. Their documentation is great to get the server up and running.
From there, I've found the best Rails Tutorial is the official ones, which can be found at http://guides.rubyonrails.org/.
A good way to also start learning stuff is to look at source code of other apps, some of which can be found at http://opensourcerails.com/.

Resources