I haven’t posted much recently as I’ve been very busy at work (more on that later) so I thought I would post another Rails tip.
## Model
class Person < ActiveRecord::Base
def to_s
self.title
end
end
# View
link_to person
# Output
<a href=\"http://foo.bar/person/1\">Zach Inglis</a>
View Pastie
Furthermore you could extend it like this:
## Model
class Person < ActiveRecord::Base
def to_s
self.title
end
def to_param
self.slug
end
end
# View
link_to person
# Output
<a href=\"http://foo.bar/person/zach-inglis\">Zach Inglis</a>
View pastie
This post popped up on my feeds and after clicking it I thought I would share my opinion here. What I have to say is more an extension of myself than a comment could do for me.
The authors main argument is that people who want to program in Ruby over Python with the Google Apps Engine are ungrateful.
First things first, +1 is fricking annoying, agreed. The people should press the star button and not comment unless they have anything decent to say
But as for the matter of wanting Ruby in Google Apps is not unfair. I have coded Python but my Ruby-fu is far far stronger. I could create wonderful things with the tools I have.
Learning another language to use a tool is a crippled philosophy. If you downloaded software to write plugins and it was a vastly different language, it could be a deal breaker for you, right? Why should it be any less? Google are getting traffic and a bunch of other goodies out of locking you into their domain.