Jump to content


VlexoFree Notice

Interviews will be open every Friday starting at 12am PDT and lasting for 24 hours.

- - - - -

just ruby


  • Please log in to reply
3 replies to this topic

#1 leke

leke

    Advanced Member

  • Members
  • 88 posts
  • LocationFinland

Posted 11 November 2010 - 02:56 AM

Hi, I noticed you had ROR installed for users, but I was wondering if we can execute ruby cgi scripts?
Here is mine which I couldn't get working...
#!/usr/bin/ruby
# vlexo.rb

puts "Content-Type: text/html"
puts
puts "<html>"
puts "<body>"
puts "<h1>Hello Ruby!</h1>"
puts "</body>"
puts "</html>"
I had also added .rb to the AddHandler in .htaccess and set my file's chmod permissions to 755.
Result: I just get a pop-up prompting me to download my script.

So have i made a mistake somewhere, or is ROR support not the same as calling ruby?

Thanks.

Edited by leke, 11 November 2010 - 11:22 PM.


Ad Bot


      #2 jerrod

      jerrod

        Advanced Member

      • Members
      • 100 posts

      Posted 11 November 2010 - 07:50 PM

      I have limited knowledge in Ruby, I knew a little awhile back. But it was used for some game a group of people were working on, so I don't know what it has to be like to work on websites as I have never known any websites that did.

      My guess is when you save it as .rb it is acting just like .js as in if you go to /page.rb it is allowing you to download the script. I believe you need to include the script into a HTML or PHP page where it is either in-puting the script from the other page in or just include it in <script type=ruby>(Prob not correct) tags on the page.

      Ill try looking up this when I get some free time prob tomorrow.
      I will try to provide you with quick support!

      NOTE: I am not on the support staff but I will try to help everyone with all types of support needed.

      #3 man94k

      man94k

        Member

      • Members
      • 20 posts

      Posted 21 August 2011 - 12:51 AM

      Hello,

      To include Ruby scripts into an HTML page, you need to embed your code between <% and %> (or <%= ... %> to replace by the value returned by the code, or <%# ... %> to be ignored).
      You can find more help here : http://ruby-doc.org/...y/html/web.html :)

      #4 leke

      leke

        Advanced Member

      • Members
      • 88 posts
      • LocationFinland

      Posted 18 November 2011 - 02:41 AM

      Thanks bro. I've just noticed the reply and didn't know it worked like that. Maybe I was reading an old tutorial or something? To be honest, I haven't continued my Ruby interest since this post, but maybe I'll take another look now :)




      0 user(s) are reading this topic

      0 members, 0 guests, 0 anonymous users