Support Forums

Full Version: Ruby on rails
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So many threads about ruby but not many about rails? I've been learning it since about 10 this morning (its 9pm) and I already love it =]

As apposed to PHP.

Code:
posts = Posts.where(:name => 'Hi')

posts.each do |post|
  puts post.name
end

That would probably take 4x as many lines to write in PHP.
4x? Lets see.

while ($row = mysql_fetch_array(mysql_query("SELECT * FROM posts WHERE name='hi'"))) { echo $row['name'] . "\n"; }

How about .25x

Suck it
(12-21-2010, 08:00 PM)Orgy Wrote: [ -> ]4x? Lets see.

while ($row = mysql_fetch_array(mysql_query("SELECT * FROM posts WHERE name='hi'"))) { echo $row['post'] . "\n"; }

How about .25x

Suck it

Honestly, your reply made me laugh. If I could rep you I would.
(12-21-2010, 08:03 PM)SehCure Wrote: [ -> ]Honestly, your reply made me laugh. If I could rep you I would.
Can't you rep?
PHP and RoR shouldn't be compared.
RoR and SQL just don't work together. PHP is much more useful imo, very efficient.
Nah you need 100 posts.


I have never heard of This language untill now.
Seems strange.
(12-21-2010, 08:00 PM)Orgy Wrote: [ -> ]4x? Lets see.

while ($row = mysql_fetch_array(mysql_query("SELECT * FROM posts WHERE name='hi'"))) { echo $row['post'] . "\n"; }

How about .25x

Suck it

Was about to reply and speak about the fact that you just put it all on one line =s. But its orgy ;)

@solidius -
May you explain why? I've worked with PHP a long time and its no secret its terrible at SQL.


oh and orgy you are echoing the post. The ruby script echos the post.name =]
Whoops, fixed and edited my post.
(12-22-2010, 06:57 AM)Orgy Wrote: [ -> ]Whoops, fixed and edited my post.

You can still see what I mean =] The syntax is a lot cleaner than PHPs