#apache #archlinux #asterisk #centos #debian #gentoo #haskell #kde #kubuntu #lisp #math #mysql #perl #python #ruby-lang #rubyonrails #suse #ubuntu #vim #wikipedia 0 1 2 3 4 5 6 7 8 9 10 11
Top Prev 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 Next
#rubyonrails
<tavilach> column.human_name
<ReinH> because it doesn't actually change the human_name
<tavilach> shouldnt that = what i typed?
<tavilach> oh it doesnt?
<ReinH> if you read the source for human_name, you'll see that it just does a string transformation on the column name itself
<tavilach> ic
<ReinH> if you want to change the human_name, just change the column name
<ReinH> or, alternatively, rewrite the scaffold yourself
<ReinH> the scaffolding is really just for demonstration anyway. It's not robust enough to make it into production code
<tavilach> yeah i know
<tavilach> but itd be nice to have it be intuitive
<tavilach> changing the column name is kinda hard because i have to do a find and replace in my whole project...
<tavilach> is there any easier way?
<smtlaissezfaire> don't ever touch or look at the scaffold code. It will only lead you to trouble
<ReinH> smtlaissezfaire: lol
<tavilach> what do you mean?
<tavilach> lol
<ReinH> which sucks
<smtlaissezfaire> It lead me on the wrong path with ruby for a long time.
<ReinH> Someone should really fix it up, make it more idiomatic to ruby
<tavilach> what do you mean huh
<ReinH> and rails for tha tmatter
<smtlaissezfaire> Well, it's just bad code. I have never seen for user in users
<ReinH> I don't write rails code that looks anything like the scaffold
<tavilach> o
<smtlaissezfaire> I've seen users.each do |user|...
<tavilach> i was going to use it to learn ruby...
<ReinH> right, that's the idiomatic way
<ReinH> heh, don't do that
<smtlaissezfaire> If you want to learn ruby, use irb
<tavilach> so whats an example of scaffolding that isnt good ruby code
<smtlaissezfaire> if you want to learn rails: first use migrations and ./script/console
<ReinH> if you want to learn ruby, read Why's Poignant Guide, the Ruby Pickaxe (both free), or buy yourself a copy of The Ruby Way
<ReinH> Check out the Ruby Pickaxe, http://www.rubycentral.com/book/
<rumple> hmmm, what does this say about ruby users? http://www.killnine.com/comics/2.php
<mileszs13> tavilach: for user in users
<mileszs13> is not good
<tavilach> why not?
<smtlaissezfaire> I don't think its awful code. I think it has a lot of tricks which a newbie isn't going to understand and the newbie is going to think that *this* scaffolding code is the way its always done
<ReinH> lmao
<tavilach> yeah thajts what i was thinking!
<mileszs13> More than anything, I guess it's just not how things are done. Like smtlaissezfaire said, @users.each do |user|
<smtlaissezfaire> because the scaffolding looks like an archetype - or at least a bare minimum form. One would expect best practices to come out of scaffolding code
<ReinH> mileszs13: it's not *bad*, it's just not idiomatic to ruby
<mileszs13> ReinH: ^
<ReinH> smtlaissezfaire: yeah, :(
<ReinH> mileszs13: :)
<tavilach> what if i like the word for..
<ReinH> So grab the newest Agile book
<tavilach> lol
Previous Page Next Page