Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Working with Ruby

  1. #11
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    A framework is an "blank slate" application to which you provide code to do as you like. In this case, Rails is an application that interfaces with your web server and runs your scripts when appropriate (e.g. when the user's request matches an URL you'd decided should point to a certain function; I'm not entirely sure how Ruby does it, but it'll be something like that). It also provides various classes and functions to help you write HTTP-based applications more easily.

    Without a Web framework such as Rails, you'd probably be using CGI. CGI provides data to your script in a very rough form, and takes output in an equally low-level manner: about half your application would likely involve handling all this low-level stuff and translating it into a higher-level form.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  2. #12
    Join Date
    Mar 2007
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So Rails makes it easier for a web server to understand the language? Does this change any coding? Do I use different syntax, methods, things like that or is is still the same?

  3. #13
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, it doesn't change the language itself. It's sort of like working with a library.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #14
    Join Date
    Mar 2007
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh thats cool! Where can you find all the things it adds?

  5. #15
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #16
    Join Date
    Mar 2007
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Okay, I got everything up and running and I'm following a tutorial on making a photo gallery. There is an .rhtml that calls for the stylesheet in, what I beleive to be , AJAX. The codeing for the page is

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html>
    	<head>
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    	<title>Flickr</title>
    	<%= javascript_include_tag :defaults %>
    	<%= stylesheet_link_tag 'flickr'  %>
    	</head>
    	
    	<body>
    	<%= yield %>
    	</body>
    </html>
    For some reason it doesn't see the style sheet and therefore doesn't display styles I have made. As far as I can see, I typed exactly what he did but I must be missing something.
    Last edited by lord_havoc; 10-31-2007 at 03:07 AM.

  7. #17
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    What's the rest of the code?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #18
    Join Date
    Mar 2007
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That file was application.rhtml

    index.rhtml is:

    Code:
    <%= form_remote_tag :url => {:action => 'search'}, :update => 'photos' %>
    
    	<fieldset>
    	<label for="tags">Tags</label>
    	<%= text_field_tag 'tags' %>
    	<%= submit_tag 'Find'%>
    	</fieldset>
    	
    	<div id="photos"></div>
    	
    <%= end_form_tag %>
    And flickr.css is
    Code:
    body{
    	background-color: #888888;
    	font-family: "Trebuchet MS";
    	font-size: .8em;
    	margin: 25px;
    }
    
    form{
    	margin: 0px;
    	margin-bottom: 10px;
    	background-color: #eeeeee;
    	border: 5px solid #333333;
    	padding: 25px;
    }
    
    fieldset{
    	border: none;
    }

  9. #19
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It's called 'flickr.css' isn't it? stylesheet_link_tag won't add the extension on for you.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #20
    Join Date
    Mar 2007
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well I didn't think so, but I'm new to AJAX. And the guy in the video didn't use the extension. I thought maybe that piece of code new to look for css files.

    Either way, it still doesn't work.

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
  •