#rubyonrails - Wed 21 Mar 2007 between 00:01 and 00:34

baggitoso the blog table has a blogger_id ?
GaryKingbaggito: it has a editor_id, which is what I specified
that's what the :foreign_key is for
baggitoi mean in the blog table
GaryKingbaggito: I know
baggito: blog.editor_id exists
baggitomaybe you want to specify belongs_to :blogger, :foreign_key => :editor_id then
GaryKingblog.editor_id => blogger.id
baggito: I tried and then my app crashed.. let me try again..
GaryKingbaggito: nevermind, worked this time :) thanks
now I have another, much more scathing issue to deal with.. argh..
GaryKingbaggito: Does :foreign_key ALWAYS go with belongs_to?
baggito: Because for another one, that's not the case, and if I move the :foreign_key to belongs_to, then my app gives me an error.
baggitoonly if it's not named logically
if you called editor_id blogger_id, i think it should work
GaryKingbaggito: I know I only use it when it's not called logically :)
baggito: I have this: "has_many :blogger_details, :foreign_key => 'user_id'" and this: "belongs_to :blogger" is that okay?
baggitowell it depends doesn't it
GaryKingbaggito: On what in particular?
baggitowell, if the key is not named <foreign-table>_id then yes
Glenn_NZGosh, you guys are up late then :)
baggitoit's 22:26 here in lima
GaryKingHow do I use .is_a?(Integer) with params when params are always strings even if it's a number?
something like is_numeric would be nice :)
pstickneGaryKing, huh?
GaryKingpstickne: I want to check if the :id is an integer, like I have /show/all or /show/1
psticknejust to_s it and if it's 0 (or invalid), then shame on them
Integer(p) rescue nil # one way
psticknebut in general, just convert it and treat it and then act, don't worry about "checking the type" so much
GaryKing/show/all looks cleaner than just /show/ :)
psticknemaybe handle that in routing?
(then you won't even get an id of "all")
and if you do, when it is to_i, it will be 0 and things will work out accordingly
GaryKingpstickne: I'm not all that familiar with routes.rb :/
I only know how to set the default one

Page: 2 9 16 23 30 37 44 51 58 65 72 79 86 93 100 107 114 121