SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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!

  2. #2
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by EasyMarketer
    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.
    Quote 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.
    Quote 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.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by EasyMarketer
    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.

  7. #7
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  8. #8
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by EasyMarketer
    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.

  9. #9
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .rhml looks like this:

    Code:
    <% a = 'Hello World!' %>
    <html>
    <body>
    <%= a %>
    </body>
    </html>
    This is like PHP, because there is Ruby in the html code. rhtml uses <% %> whereas PHP uses <?php ?>.

  10. #10
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  11. #11
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Why have file extensions at all?

  12. #12
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah. i see what you mean, i can make them all directories!

  13. #13
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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:

    www.mycookbook.com

    I did all of that, but its not saying its listening to that ip or whatever and its not working even tho it sais everything is working correctly, what do i do to fix it.

  14. #14
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Did you change mycookbook.com to point to 127.0.0.1 in your hosts file?

  15. #15
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  16. #16
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by EasyMarketer
    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
    Quote 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++.

  17. #17
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  18. #18
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rails is a framework, written in Ruby. Without Ruby Rails is nothing. Rails can generate "Ajax".

  19. #19
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  20. #20
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  21. #21
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •