#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2009
    Posts
    184
    Rep Power
    28

    Question ROR confusion using methods


    Okay, I am very new to ruby. I have written several standard ruby programs and now I am starting to learn ROR. I am a bit confused though. In a standard ruby program I create a method and then in the main program I pass a variable to the method and have the method print out a value. Now, I know I use the controller file and the index file to do this, but I am unsure exactly how to include the method and to call it.


    def print(value)
    puts(value)
    end

    print(10)

    I need to do something like this in ROR, but I am not sure just how. It is simple in just a standard ruby program. Any help would be appreciated.

  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2009
    Posts
    4
    Rep Power
    0
    If it's just a "standard ruby program," why are you using Rails?

    Also, google "MVC" and click the first link.
  4. #3
  5. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2010
    Posts
    5
    Rep Power
    0
    Suggest you visit rubyonrails DOT org and try the tutorial to see how to build a rails app from scratch. That will show you the basic conventions. From there you should be able to map your application to the rails framework.

IMN logo majestic logo threadwatch logo seochat tools logo