The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Ruby on rails question!

Hello, im curious i just picked up a book, for it, Is there any database for it already like mysql? what is the limits to it, from what i have read from it. It doesnt have any database to make user systems in.
Basically it seems like it just puts out html in .rhtml format its confusing to me.

Can someone explain this to me if there is a database, or no. What ror can do, like can you build a user system with ror alone. and what database do i use to do this.
Thanks!

RoR is a framework, written in the language Ruby. Rails can connect to many databases, but mysql seems to be the most popular. You can build a user system with it, you can use mysql. You have to learn how to program in Ruby first, and how to use Rails after that.

Oh, ic so as i was reading more of this book it is teaching me ruby itself, I have looked at several scripts, and i see that .rb is used alot in one of the scripts a music store actually:P but they do not use .rhtml anywhere in there, Why is that.
Is it like in php where php files are like template files sort of and .inc files are the more core part of it. Im curious on that. What is the difference between the .rhtml and .rb files. they are both used on the servers i have noticed. This is all interesting to me lol.
The book doesnt really go over rails it goes over ruby more just a little bit on rails. Should i learn rails or ruby first? and can you use ruby on the web without rails?

Hello, im curious i just picked up a book, for it, Is there any database for it already like mysql?

There's no database specifically for Ruby on Rails, but there's no database specifically for any language. Rails works with SQLite,MySQL, PostgreSQL, Oracle, SQL Server, DB2, and others.

Originally Posted by EasyMarketer

what is the limits to it, from what i have read from it. It doesnt have any database to make user systems in.

I don't understand this statement. What do you mean by "user system"? Some sort of authentication? You can do that using any database and some Rails plugins, like Acts as Authenticated to make your job easier.

Originally Posted by EasyMarketer

Basically it seems like it just puts out html in .rhtml format its confusing to me.

It can also spit out XML, PDF, images, or whatever you want. Your only real limit there is the technology you know.

Ok, and yes i ment user authentication :P alright I see what you mean it can spit out xml pdf and everything.
But what is the difference between .rb and .rhtml that is what is bugging me lol.

.rb = Ruby scripting only
.rhtml = Ruby mixed with HTML
.rxml = Ruby mixed with XML, made with Builder (this started as part of Rails but is now its own project).
.rjs = Ruby code that generates Javascript

And to answer your previous questions, yes it's possible to build websites/apps with Ruby and not Rails. You can use another framework like Nitro or Camping, you can use eruby, you can use WEBrick servlets, or you can use CGI. Using a framework tends to make things easier, but it's not the only way by a long shot.

Wow Ruby is a great language now im starting to see, But waaay more complicated then php. this is all really cool, This may be a dum question but...
What do you put if you are using
ruby
javascript and html all in one code?
Or do you have to break them all up?

Wow Ruby is a great language now im starting to see, But waaay more complicated then php. this is all really cool, This may be a dum question but...
What do you put if you are using
ruby
javascript and html all in one code?
Or do you have to break them all up?

You can do that in a .rhtml file like you would with PHP, but it's not a good idea really since you're mixing up business and presentation logic, which is never a good thing when you come back to maintain your code.

Well, i got instant rails installed on my computer, This is amazing to me, I think after i get it down a little bit i want to try and build a simple cms in ruby on rails. And have the extra links as .rhtml that'll look cool
Yall dont mind if i bump this thread if i have another question will you?

Ahh this aint good, anyone familiar with instant rails? it tells me to after i install it which i did plus configure it here is what it told me to do.
In the main menu, select Rails Applications > Manage Rails Applications...

* Check the checkbox next to the cookbook application.

* Click on the Start SCGI button.

* Once the SCGI server says that it is listening to 127.0.0.1:9999, open
our browser and go to:

Yep, i found it out It was dum internet explorer :P it worked perfectly in mozilla firefox lol.

You seem to have quite alot of knowledge on ruby itself not even counting rails.
I was wondering how fast is ruby when it is used client side, i have heard that C++ isnt even as fast as C. IS Ruby any different will it be about the same speed? I have googled for it, and nothing really came up about it just alot of junk.

Yep, i found it out It was dum internet explorer :P it worked perfectly in mozilla firefox lol.

You seem to have quite alot of knowledge on ruby itself not even counting rails.

Not really I just know how to fake it

Originally Posted by EasyMarketer

I was wondering how fast is ruby when it is used client side, i have heard that C++ isnt even as fast as C. IS Ruby any different will it be about the same speed? I have googled for it, and nothing really came up about it just alot of junk.

Ruby is pretty slow, especially compared to C/C++. Projects are underway to make it faster in future versions. But as someone else in this forum said, Ruby is slow if you're the computer, but it's fast if you're the programmer.

If your application really NEEDS to be fast though, you should definitely use a language like C++.

yes, for the web part of it I like ror its just really neat. You answered it tho, I guess i will not be building apps inside of ruby tho unless they make it way faster. My search engine i was just now starting to think about building it in ruby because of the Xml function it has, And the kind of search engine im trying to make involves alot of xml and rss lol :P
Well, since i cannot do it that way. i will have to use C for it.

I think i am starting to get more of the ruby language down.
Rails is the framework which ruby can use. But rails isnt just for ruby it can be used for ajax as well which is interesting. There is still a couple things in my mind about how it works with rails but im pretty sure i will figure it out. Like, I know ruby is its own language, and rails is built from ruby but what is coooooonfusing me is the fact that you dont even need to know how to se ruby to build aplications in rails. That is what Is just blowing my mind. But when im looking through source codes, im seeing .rb extensions which stands for ruby Im not even getting what the rails does to it. IT all looks like ruby to me.

So basically lets say i make something in Ruby Where would the rails come into play?

i know, but the question is, what does rails have to do if all of the files i have seen are in ruby itself. like example files. Lets say i make a cms and all of the files are .rb
What would rails do to them?

It depends on where they are located and what their contents are. Rails takes the MVC approach, off of the top of my head controllers, helpers, migrations, models, and tests all use the rb extension. Your best bet would be to read a book or use your search engine of choice.

I think i may have found it on here http://www.rorlearn.com/
Please tell me if i am correct in saying.
You do not even need to use rails framework to build a application.
If you use the rails framework you wont have to build the code just tell rails the code that you need it to make in the .rb file. Or you can just make the full code, yourself.
I think this is why php takes so long to make the files, because you have to make the entire code, instead of it having it already premade. Am i correct? if not please let me know, This is exactly what im thinking