kyb3r_ has quit [Read error: Connection reset by peer]
mistym has quit [Remote host closed the connection]
tbuehlmann has joined #ruby-lang
yfeldblum has joined #ruby-lang
hahuang61 has quit [Ping timeout: 255 seconds]
pr0ton has quit [Quit: pr0ton]
Averna has quit [Quit: Leaving.]
vintik has quit [Remote host closed the connection]
skade has joined #ruby-lang
clauswitt has joined #ruby-lang
AKASkip has joined #ruby-lang
gix has quit [Quit: Client exiting]
futilegames has joined #ruby-lang
gix has joined #ruby-lang
elia has joined #ruby-lang
clauswit_ has joined #ruby-lang
clauswitt has quit [Ping timeout: 264 seconds]
yxhuvud has quit [Remote host closed the connection]
yxhuvud has joined #ruby-lang
ta has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
futilegames has quit [Quit: futilegames]
sMecKs has quit [Read error: Connection reset by peer]
koderok has quit [Quit: koderok]
hellangel7 has joined #ruby-lang
hellangel7 has quit [Max SendQ exceeded]
hellangel7 has joined #ruby-lang
mikecmpbll has joined #ruby-lang
stardiviner has joined #ruby-lang
<yorickpeterse>
morning
AKASkip has quit [Ping timeout: 250 seconds]
Forgetful_Lion has joined #ruby-lang
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gamov has joined #ruby-lang
vintik has joined #ruby-lang
AKASkip has joined #ruby-lang
qba73 has joined #ruby-lang
vintik has quit [Ping timeout: 240 seconds]
chaos7theory has quit [Quit: Leaving]
danijoo has quit [Read error: Connection reset by peer]
joelmheim_ is now known as joelmheim
danijoo has joined #ruby-lang
willmarshall has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vintik has joined #ruby-lang
InfraRuby has left #ruby-lang [#ruby-lang]
ssam2 has joined #ruby-lang
koderok has joined #ruby-lang
arBmind has joined #ruby-lang
skade has joined #ruby-lang
jhass|off is now known as jhass
skade has quit [Client Quit]
ur5us has joined #ruby-lang
Forgetful_Lion has quit [Ping timeout: 250 seconds]
unsymbol has quit [Ping timeout: 264 seconds]
Forgetful_Lion has joined #ruby-lang
unsymbol has joined #ruby-lang
benlovell has joined #ruby-lang
vintik has quit [Remote host closed the connection]
workmad3 has joined #ruby-lang
Cakey has quit [Ping timeout: 240 seconds]
marr has joined #ruby-lang
nofxx_ has quit [Ping timeout: 245 seconds]
danijoo has quit [Read error: Connection reset by peer]
danijoo has joined #ruby-lang
Blaguvest has joined #ruby-lang
stamina has joined #ruby-lang
kek has joined #ruby-lang
fullybaked has joined #ruby-lang
stef_204 has joined #ruby-lang
Miphix has quit [Quit: Leaving]
kyb3r_ has joined #ruby-lang
faces has joined #ruby-lang
face has quit [Ping timeout: 245 seconds]
gamov has quit [Quit: gamov]
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
dangerou_ has joined #ruby-lang
dangerousdave has quit [Ping timeout: 260 seconds]
heavyhorse has joined #ruby-lang
elia has quit [Read error: Connection reset by peer]
elia has joined #ruby-lang
davispuh has joined #ruby-lang
heavyhorse has quit [Quit: Computer has gone to sleep]
arBmind has quit [Quit: Leaving.]
heavyhorse has joined #ruby-lang
koderok has quit [Quit: koderok]
heavyhorse has quit [Ping timeout: 250 seconds]
koderok has joined #ruby-lang
heftig has joined #ruby-lang
Cakey has joined #ruby-lang
sarkyniin has joined #ruby-lang
banister_ has quit [Read error: Connection reset by peer]
tkuchiki_ has joined #ruby-lang
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
banister has joined #ruby-lang
arBmind has joined #ruby-lang
toretore has quit [Read error: No route to host]
amystephen has joined #ruby-lang
tkuchiki has quit [Ping timeout: 250 seconds]
diegoviola has joined #ruby-lang
tkuchiki_ has quit [Ping timeout: 255 seconds]
toretore has joined #ruby-lang
bin7me has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
ldnunes has joined #ruby-lang
ur5us has joined #ruby-lang
tkuchiki has joined #ruby-lang
hellangel7 has quit [Read error: Connection reset by peer]
DEac- has quit [Quit: leaving]
DEac- has joined #ruby-lang
ur5us has quit [Ping timeout: 256 seconds]
agrinb has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kyb3r_ has quit [Read error: Connection reset by peer]
riffraff has joined #ruby-lang
spastorino has joined #ruby-lang
skade has joined #ruby-lang
setmeaway has joined #ruby-lang
agrinb has quit [Remote host closed the connection]
agrinb has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
agrinb has quit [Ping timeout: 244 seconds]
karamazov has joined #ruby-lang
stef_204 has quit [Remote host closed the connection]
Cakey has quit [Ping timeout: 260 seconds]
ironhide_604 has joined #ruby-lang
Sgeo_ has quit [Read error: Connection reset by peer]
weems|mac has joined #ruby-lang
weems|mac has quit [Client Quit]
hahuang61 has joined #ruby-lang
elia has joined #ruby-lang
jds has quit [Quit: Connection closed for inactivity]
stamina has quit [Ping timeout: 250 seconds]
agrinb has joined #ruby-lang
hellangel7 has joined #ruby-lang
diegovio1 has joined #ruby-lang
koderok has quit [Quit: koderok]
diegoviola has quit [Ping timeout: 255 seconds]
agrinb has quit [Ping timeout: 260 seconds]
symm- has joined #ruby-lang
setmeaway has quit [Quit: Leaving]
diegovio1 has quit [Ping timeout: 256 seconds]
dangerou_ has quit []
stef_204 has joined #ruby-lang
malconis has joined #ruby-lang
ur5us has joined #ruby-lang
malconis has quit [Remote host closed the connection]
malconis has joined #ruby-lang
ur5us has quit [Ping timeout: 264 seconds]
marr has quit [Ping timeout: 250 seconds]
diegoviola has joined #ruby-lang
miqui has joined #ruby-lang
hahuang61 has quit [Ping timeout: 256 seconds]
jgpawletko has joined #ruby-lang
Forgetful_Lion has quit [Remote host closed the connection]
<yorickpeterse>
Refactoring code from early 2012
<yorickpeterse>
awww yiss
<yorickpeterse>
I was supposed to simply add some dotenv stuff to this project
<yorickpeterse>
^ this is why I suck at planning, I always find stuff my brain thinks I have to do
kaiwren has quit [Quit: kaiwren]
banister has joined #ruby-lang
Atttwww has joined #ruby-lang
koderok has joined #ruby-lang
torrieri has quit [Ping timeout: 250 seconds]
vondruch has quit [Ping timeout: 244 seconds]
fullybak_ has joined #ruby-lang
rcvalle has joined #ruby-lang
fullybaked has quit [Ping timeout: 240 seconds]
workmad3 is now known as wm3|away
<henrikhodne>
Is there a method on Hash that works similar to Hash#fetch, but it's using the block to "modify" the value?
meizaps has quit [Ping timeout: 260 seconds]
<henrikhodne>
That is, I would like something like this: hsh.the_method(:a_key) { |str| " --something=#{str}" } where " --something=#{hsh[:a_key]}" is returned if :a_key is in the hash, or nil otherwise.
<jhass>
no, but you can write (str = hash[:a_key]) && "--something=#{str}"
<henrikhodne>
I suppose that would work too. Right now I'm doing hsh[:a_key] ? " --something=#{hsh[:a_key]}" : "", which is slightly different, but returning nil would work too since I interpolate it into a string again later.
znz_jp has quit [Ping timeout: 250 seconds]
karamazov has quit []
<jhass>
so you're building an argument list for a command invocation?
<Kero>
henrikhodne: modifying ssh settings without user consent (in any way) is bad practice
rmcafee has joined #ruby-lang
centrx has joined #ruby-lang
charliesome has quit [Ping timeout: 264 seconds]
jgoetze has joined #ruby-lang
charliesome has joined #ruby-lang
jgoetze has quit [Client Quit]
stef_204 has joined #ruby-lang
jgoetze has joined #ruby-lang
zz_anildigital is now known as anildigital
pglombardo has joined #ruby-lang
<jgoetze>
Hey guys,
<jgoetze>
i created a facebook page called "Your Daily Dose Of Ruby"! There you will get every day a random method of a random class of the ruby library. A post contains the description of everything related, the links and an image showing an example. So if you are ready to get your daily dose, check it out and you might learn some stuff you didnt know.
<jgoetze>
Greetz
<jgoetze>
Link: fb.com/672461062828915
<jgoetze>
nisstyre has joined #ruby-lang
lcdhoffman has joined #ruby-lang
shinnya has joined #ruby-lang
jgoetze has quit [Client Quit]
momomomomo has joined #ruby-lang
danromano has quit [Quit: Leaving]
<tbuehlmann>
facebook? not gonna happen.. :\
Taranis has joined #ruby-lang
loincloth has joined #ruby-lang
ta has quit [Remote host closed the connection]
weems|mac has quit [Quit: weems|mac]
znz_jp has quit [Ping timeout: 250 seconds]
momomomomo has quit [Quit: momomomomo]
hahuang61 has joined #ruby-lang
znz_jp has joined #ruby-lang
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
johnpclaus has joined #ruby-lang
Boohbah has quit [Remote host closed the connection]
Boohbah has joined #ruby-lang
momomomomo has joined #ruby-lang
fullybaked has joined #ruby-lang
malconis has joined #ruby-lang
Missphoenix has joined #ruby-lang
clauswit_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cmhobbs has joined #ruby-lang
cmhobbs has joined #ruby-lang
Miphix has quit [Ping timeout: 250 seconds]
stardiviner has quit [Ping timeout: 255 seconds]
koderok has quit [Quit: koderok]
ari-_-e has quit [Quit: Leaving]
Miphix has joined #ruby-lang
momomomomo has quit [Quit: momomomomo]
mistym has joined #ruby-lang
wm3|away is now known as workmad3
Missphoenix has quit [Ping timeout: 244 seconds]
weems|mac has joined #ruby-lang
nathanstitt has joined #ruby-lang
fullybaked has quit []
fullybaked has joined #ruby-lang
stardiviner has joined #ruby-lang
mistym has quit [Remote host closed the connection]
stardiviner has quit [Client Quit]
hahuang61 has quit [Ping timeout: 245 seconds]
Mandros has joined #ruby-lang
hahuang61 has joined #ruby-lang
fullybaked has quit []
Cakey has joined #ruby-lang
Cakey has quit [Ping timeout: 255 seconds]
solars has quit [Ping timeout: 240 seconds]
tbuehlmann has quit [Quit: Leaving]
fullybaked has joined #ruby-lang
mistym has joined #ruby-lang
weems|mac has quit [Quit: weems|mac]
AKASkip has quit [Ping timeout: 250 seconds]
Miphix has quit [Quit: Leaving]
shinnya has quit [Ping timeout: 245 seconds]
koderok has joined #ruby-lang
pixelhandler has joined #ruby-lang
stardiviner has joined #ruby-lang
|jemc| has joined #ruby-lang
stamina has joined #ruby-lang
ruby-lang828 has joined #ruby-lang
hramrach has joined #ruby-lang
<hramrach>
hello
sepp2k has quit [Quit: Konversation terminated!]
<jhass>
hi
skade has quit [Quit: Computer has gone to sleep.]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
momomomomo has joined #ruby-lang
koderok_ has joined #ruby-lang
koderok has quit [Write error: Connection reset by peer]
koderok_ is now known as koderok
emmesswhy has joined #ruby-lang
weems|mac has joined #ruby-lang
<gregf_>
function recurseSanitize(&$data) { foreach ( $data as $key => $val ){ if ( is_array($val) ){ recurseSanitize($val); } else { $data[$key] = htmlentities($val, ENT_QUOTES); } } }
<gregf_>
bah :/ sorry
<ericwood>
nice code there
<hramrach>
how do I make a string containing the bytes 0..255?
satman has joined #ruby-lang
<jhass>
(0..255).to_a.pack("C*")
<yorickpeterse>
def magic_start_time; 1100000000; end # wat
<yorickpeterse>
that's like `def random_number; 4; end`
<jhass>
it's magic!
<yorickpeterse>
it's magic in that I have no idea what it's based on
<yorickpeterse>
clearly this code is self documenting
<jhass>
you forgot the # chosen by fair dice roll
<yorickpeterse>
maybe I should use the Git history as the documentation
<hramrach>
I have a table which defines how it translates to UTF-8
momomomomo_ has joined #ruby-lang
<ericwood>
UTF-8 outta be enough for anyone
<hramrach>
the data is not in it
<jhass>
in what is it?
centrx has quit [Quit: Mead error: Connection reset by beer]
<hramrach>
result of bogus encoding
<dacamp>
zenspider: found my etcutils bug. I'm an idiot and didn't register those variables with the ruby gc.
<jhass>
in what way bogus? encode has a number of parameters to deal with invalid stuff
<hramrach>
somebody translated Latin2 to UTF-8. twice
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
momomomomo has quit [Ping timeout: 245 seconds]
momomomomo_ is now known as momomomomo
<jhass>
can't you reverse that by assuming it's UTF-8, encode it to Latin2 then assume it's UTF-8 again?
<hramrach>
it does not seem to work just reverse-encoding it twice
<jhass>
do you have some example data to play with?
<hramrach>
or once
<hramrach>
I can artifically break some random web page if need be
rippa has joined #ruby-lang
<hramrach>
but the data produced by simply reverse-encoding is invalid
<hramrach>
a tool says it's doubly-encoded but there is no tool that reverses the effect
sharpmachine has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
<yorickpeterse>
One does not simply "create an encoding"
<jhass>
"fööbär".encode(Encoding::ISO8859_2).encode("UTF-8").force_encoding(Encoding::ISO8859_2).encode("UTF-8").encode(Encoding::ISO8859_2).force_encoding("UTF-8") returns the original string for me
<yorickpeterse>
it's not a matter of Encodings['my_encoding'] << something
yfeldblum has quit [Remote host closed the connection]
<apeiros>
hramrach: ^ seem you're doing it wrong
<apeiros>
*seems
yfeldblum has joined #ruby-lang
<apeiros>
`ruby -v` prints the ruby version. RUBY_VERSION gives you the information in code.
<hramrach>
yes, the method is defined and ri does no know about it
<hramrach>
looks like the package is broken
<apeiros>
looks like you didn't install the docs
<hramrach>
yes, it does not know about scan either
torrieri has joined #ruby-lang
yfeldblum has quit [Ping timeout: 260 seconds]
ssam2 has quit [Quit: Leaving]
workmad3 has quit [Ping timeout: 240 seconds]
sarkyniin has quit [Quit: Quitte]
arBmind has joined #ruby-lang
arooni-mobile has quit [Ping timeout: 264 seconds]
banister_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
stamina has quit [Quit: WeeChat 0.4.3]
anjen has joined #ruby-lang
anjen has quit [Read error: Connection reset by peer]
<hramrach>
anyway, scrub is not exactly what I am looking for
<hramrach>
hmm, dependency problem
<hramrach>
still might be nice for some other cases
<hramrach>
thanks for help
<darix>
hramrach: what are you looking for?
torrieri has quit [Quit: Leaving...]
<darix>
by definition bytes can only be 0-255. ... from what i gathered "remove all codepoints > 255"
<darix>
although transliterate might be better
<darix>
though you still need some assumption what kind of characterset is supposed to be in your string.
<hramrach>
I looked into repairing a broken string
AKASkip has joined #ruby-lang
<darix>
hramrach: so force encoding on what you think is in it
<hramrach>
and I can't seem to figure out how exactly it is broken
<darix>
and scrub the rest
<apeiros>
scrubbing should be a last resort
<darix>
apeiros: got better suggestion?
<apeiros>
not having seen his original problem - no
<darix>
true
<darix>
with more details a better solution might be viable ... but generic solution would still be force_encoding+scrub :p
<darix>
later
<apeiros>
generic "better solution" is: ensure your sources play nice and deliver strings in the correct encoding. if you can't, ensure you know the encoding and transcode. if neither, you're already quite fucked.
<darix>
apeiros: that sounds so hard. cant you say that more nicely?:p
charliesome has joined #ruby-lang
sarkyniin has joined #ruby-lang
benlovell has joined #ruby-lang
<apeiros>
darix: sure
kek has quit [Remote host closed the connection]
anjen has joined #ruby-lang
dknox-bbib is now known as dknox
anjen has quit [Client Quit]
momomomomo has joined #ruby-lang
<hramrach>
hmm, seems í is translated to \xC3 by the broken conversion
<hramrach>
\xC3\x84 more precisely
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
bjessbrown has joined #ruby-lang
banister has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
banister has quit [Max SendQ exceeded]
banister has joined #ruby-lang
alexju has quit [Remote host closed the connection]
* hramrach
wants hiew with encoding support
torrieri has joined #ruby-lang
sharpmachine has quit [Remote host closed the connection]
<bjessbrown>
Hello, can someone help with a question about yaml and ruby hashes?
<bjessbrown>
Ruby 2.1.2
<bjessbrown>
—————————
<bjessbrown>
h = {a: "lskdjf", b: "lskdjf"}
<bjessbrown>
=> {:a=>"lskdjf", :b=>"lskdjf"}
<bjessbrown>
h.to_yaml
<bjessbrown>
=> "---\n:a: lskdjf\n:b: lskdjf\n"
<bjessbrown>
y = h.to_yaml
<bjessbrown>
=> "---\n:a: lskdjf\n:b: lskdjf\n"
<bjessbrown>
YAML.load y
dangerousdave has joined #ruby-lang
<bjessbrown>
=> {":a"=>"lskdjf", ":b"=>"lskdjf"}
<bjessbrown>
Ruby 2.1.1
<bjessbrown>
——————————
<bjessbrown>
h = {a: "lskdjf", b: "sldkjf"}
<bjessbrown>
=> {:a=>"lskdjf", :b=>"sldkjf"}
<bjessbrown>
h.to_yaml
<bjessbrown>
=> "---\n:a: lskdjf\n:b: sldkjf\n"
<bjessbrown>
y = h.to_yaml
<bjessbrown>
=> "---\n:a: lskdjf\n:b: sldkjf\n"
<bjessbrown>
YAML.load(y)
<bjessbrown>
=> {:a=>"lskdjf", :b=>"sldkjf"}
<bjessbrown>
checkout the hash from 2.1.2
<apeiros>
bjessbrown: be so gentle to use a paste service, like gist.github.com
InfraRuby has left #ruby-lang [#ruby-lang]
<bjessbrown>
aperios: thanks, I'm not a big IRC user, so didn't realize it would come out that way
<hramrach>
I can't reproduce it either wit the freshly installed ruby 2.1.2p95 (2014-05-08)
<hramrach>
bjessbrown: what exact 2.1.2 version?
<apeiros>
there's only one, hramrach
<bjessbrown>
thanks guys, maybe something wrong with my ruby...if I load outside the rails env, I'm now getting undefined method `to_yaml' for {:a=>"lskdjf", :b=>"lskdjf"}:Hash
<apeiros>
bjessbrown: you have to `require 'yaml'` first
Guest65314 has quit [Read error: Connection reset by peer]
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<hramrach>
like "irb -r yaml"
<bjessbrown>
ok, strange, didn't have to in 2.1.1
Guest65314 has joined #ruby-lang
<bjessbrown>
ok, I'm getting expected result now, must be something in my rails app
<apeiros>
bjessbrown: yes, you did have to
<apeiros>
unless you've had RUBYOPT set, but since that'd affect 2.1.2 too, it's rather unlikely.
dangerousdave has quit []
loincloth has quit [Remote host closed the connection]
<bjessbrown>
apeiros: ah, maybe pry loads it? (don't have to with pry but do with irb)
dangerousdave has joined #ruby-lang
<apeiros>
quite possible. I have it in my pryrc, so no idea whether pry reads it on its own already
<jhass>
gpg_: .each do |modifiers| puts "category_modifiers:#{modifiers.inspect}" end ?
|jemc| has joined #ruby-lang
<jhass>
you're iterating over it btw, we say map when you call .map
monees has joined #ruby-lang
<gpg_>
*iterate sorry
<gpg_>
jhass: thanks
mikecmpbll has joined #ruby-lang
loincloth has joined #ruby-lang
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
elia has quit [Quit: Computer has gone to sleep.]
torrieri_ has joined #ruby-lang
torrieri has quit [Ping timeout: 250 seconds]
InfraRuby has joined #ruby-lang
palar has joined #ruby-lang
toastynerd has quit [Remote host closed the connection]
emmesswhy has quit [Quit: This computer has gone to sleep]
lcdhoffman has quit [Quit: lcdhoffman]
skade has joined #ruby-lang
chouhoul_ has joined #ruby-lang
benlovell has quit [Ping timeout: 264 seconds]
hahuang61 has quit [Ping timeout: 245 seconds]
sepp2k has quit [Read error: Connection reset by peer]
alexju has joined #ruby-lang
skade_ has joined #ruby-lang
benlovell has joined #ruby-lang
relix has quit [Read error: Connection reset by peer]
chouhoulis has quit [Ping timeout: 264 seconds]
relix has joined #ruby-lang
bjessbrown has quit [Remote host closed the connection]
alexju has quit [Remote host closed the connection]
skade has quit [Ping timeout: 255 seconds]
chouhoul_ has quit [Remote host closed the connection]
skade_ has quit [Ping timeout: 255 seconds]
skade has joined #ruby-lang
JohnFord has joined #ruby-lang
sharpmachine has quit [Remote host closed the connection]
bin7me has quit [Read error: Connection reset by peer]
sharpmachine has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
tkuchiki has quit [Remote host closed the connection]
havenwood has joined #ruby-lang
tkuchiki has joined #ruby-lang
tectonic has joined #ruby-lang
solars has joined #ruby-lang
monees has quit [Ping timeout: 256 seconds]
havenwood has quit [Remote host closed the connection]
tectonic has quit [Client Quit]
torrieri_ has quit [Quit: Leaving...]
<gpg_>
jhass: i suppose i didnt explain it well. i am renderig json and want to iterate through each "category_modifiers" attribute and assign to it each array item ie [#<ProductCategory category_modifiers: [7, [5, 4, 54, 55]], #<ProductCategory category_modifiers: [8, [6]] ] etc
<gpg_>
i know this one has a hash was thinking rendering an array inside an array is acceptable?
sharpmachine has quit [Remote host closed the connection]
<toretore>
is your attribute called category_modifiers or cat_modifiers?
<gpg_>
category_modifiers
<toretore>
i don't see it in the code
Guest65314 has quit [Read error: Connection reset by peer]
bjessbrown has joined #ruby-lang
bjessbrown has quit [Remote host closed the connection]
<gpg_>
ah ok then cat_modifiers its a non persistent attribute , not in db, so can call it whatever. i am also using active model serializers gem to populate the non persistent attribute on the fly.
<toretore>
sigh
<toretore>
what is your actual question?
<toretore>
you need to explain better what it is you want to do
benlovell has quit [Ping timeout: 255 seconds]
<gpg_>
how to iterate through model.category_modifiers and assign each array item to each iteration?
torrieri has joined #ruby-lang
<toretore>
what is model.category_modifiers ?
<toretore>
it's not in your code
elia has joined #ruby-lang
<gpg_>
it must be something like model.category_modifiers.each {|i| i.category_modifiers = array[i]} ?
<toretore>
what is model.category_modifiers ?
<gpg_>
category_modifiers is only defined in model with attr_accessor :category_modifiers
<gpg_>
i am populating this attribute in controller
nathanstitt has quit [Read error: Connection reset by peer]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jbardin has joined #ruby-lang
greset has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fullybaked has joined #ruby-lang
emmesswhy has joined #ruby-lang
<cmhobbs>
i'm working on a class that should instantiate subclasses of itself based on the class of the object passed in, is there a good way to do this other than using strings?
<cmhobbs>
that's word soup
JohnFord has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<cmhobbs>
if this imaginary class is Foo, and I hand the constructor a Bar object (say Foo.new(Bar.new)), i'd like to build a Foo::Bar object as the result
<cmhobbs>
the only way i can think of doing that is calling class on the object passed in and making a constant out of "Foo + #{bar_object.class}"
<cmhobbs>
that feels pretty gross
<cmhobbs>
well, "Foo::#{bar_object.class}"
<cmhobbs>
sorry
<cmhobbs>
and turn that into a constant
<cmhobbs>
is there a better way to build constants?
vintik has quit [Remote host closed the connection]
fullybaked has quit []
arooni-mobile has joined #ruby-lang
dangerousdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JohnFord has joined #ruby-lang
saarinen has quit [Quit: saarinen]
pr0ton has joined #ruby-lang
<jhass>
inside Foo you can do const_get(bar_object.class.name)
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
bjh13 has joined #ruby-lang
ur5us has joined #ruby-lang
skade has quit [Ping timeout: 255 seconds]
bjh13 has quit [Client Quit]
banister has joined #ruby-lang
skade has joined #ruby-lang
skade has quit [Client Quit]
bunk__ has joined #ruby-lang
<cmhobbs>
jhass, the issue there is that if, say, i pass in Baz
<cmhobbs>
and Foo::Baz does not exist
<cmhobbs>
Foo.const_get(:Baz) is going to return Baz
<cmhobbs>
rather than screaming at me
<cmhobbs>
const_get will crawl up the object tree
<cmhobbs>
is there a way to scope const_get, for lack of better words?
cleopatra has quit [Ping timeout: 255 seconds]
tectonic has joined #ruby-lang
<jhass>
docs say const_get(bar_object.class.name, false)
djbkd has quit [Read error: Connection reset by peer]
ldnunes has quit [Quit: Leaving]
InfraRuby has left #ruby-lang [#ruby-lang]
djbkd has joined #ruby-lang
monees has quit [Remote host closed the connection]
saarinen has joined #ruby-lang
anildigital is now known as zz_anildigital
sharpmachine has quit [Remote host closed the connection]
NemesisD has joined #ruby-lang
Squarepy has joined #ruby-lang
saarinen has quit [Ping timeout: 255 seconds]
<cmhobbs>
brilliant! thanks!
loincloth has quit [Remote host closed the connection]
saarinen has joined #ruby-lang
pr0ton has quit [Quit: pr0ton]
DEac- has quit [Quit: leaving]
DEac- has joined #ruby-lang
ihme-TTilus is now known as TTilus
loincloth has joined #ruby-lang
AlJaMa has joined #ruby-lang
ascarter has quit [Ping timeout: 255 seconds]
dangerousdave has joined #ruby-lang
ascarter has joined #ruby-lang
ascarter has quit [Max SendQ exceeded]
<NemesisD>
hey folks. forgive the cross post but i'm experiencing an issue in a rails app and i'm not sure if the problem lies in rails
ascarter has joined #ruby-lang
<AlJaMa>
Hi All. Have a quick question about how I should go about overriding methods. I've done a small example http://pastebin.com/DL2B2gQN
ascarter has quit [Max SendQ exceeded]
<jhass>
NemesisD: as long as you tell and share back, crossposting is fine
<AlJaMa>
Basicly, I'm trying to call a method in parent class from a diffrent method in a child class
ascarter has joined #ruby-lang
ascarter has quit [Max SendQ exceeded]
JohnFord has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<NemesisD>
every few hours or so my app servers will seemingly get poisoned, activerecord's connection pooling uses MonitorMixin for locking. my app servers begin failing to serve requests because an instance variable in monitor mixin (@mon_mutex) is nil or in some weirder state
<jhass>
AlJaMa: seems like broken OOP, but you need to save a reference to the original method with alias_method before overriding it
ascarter has joined #ruby-lang
ascarter has quit [Max SendQ exceeded]
<jhass>
AlJaMa: also class names need to start with an uppercase letter ;)
ascarter has joined #ruby-lang
ascarter has quit [Max SendQ exceeded]
<AlJaMa>
jhass: thanks :)
<NemesisD>
so internally on initialize, monitor mixin sets @mon_mutex to a Mutex, but when these errors start cropping up, @mon_mutex must be nil because i get undefined method lock for nilClass. or even *weirder*, i start getting "TypeError: wrong argument type mutex (expected mutex)" when lock is called
<NemesisD>
i've done some research and have found very little, but that this can happen if you include monitormixin and don't call super immediately, but rails' abstractadapter does that
ascarter has joined #ruby-lang
ascarter has quit [Max SendQ exceeded]
<NemesisD>
i don't know how it could enter this corrupted state, so to keep my stuff alive right now i'm restarting my app servers once an hour :/
james has joined #ruby-lang
ascarter has joined #ruby-lang
ascarter has quit [Max SendQ exceeded]
james is now known as jamesfordummies
ascarter has joined #ruby-lang
<jhass>
NemesisD: hard to debug stuff. I'd look out for assignments to @mon_mutex and usages of instance_variables, instance_variable_set and the like
brianpWins has quit [Ping timeout: 245 seconds]
toastynerd has quit []
<NemesisD>
jhass hmm, yeah, i only ever see it set in the initializer, but MonitorMixin overrides initialize to do super; mon_initialize
tectonic has quit []
<NemesisD>
so i wonder if its like someone calls AbstractAdapter.new, mon calls super *first*, that blows up, but it gets caught further down and someone has a reference to that AbstractAdapter?
<NemesisD>
i don't know if throwing exceptions during initialize can still leave you with a partially-initialized object
symm- has quit [Ping timeout: 260 seconds]
vintik has joined #ruby-lang
pr0ton has joined #ruby-lang
cfkoch has joined #ruby-lang
<NemesisD>
jhass: i wish i could just pry into the server when this happens but it happens randomly after some amount of time and then completely brings my servers to their knees
<jhass>
yeah, pry-rescue on the exception probably won't work either
<NemesisD>
nah. especially not with passenger
x0f_ has quit [Ping timeout: 240 seconds]
<NemesisD>
i almost want a state of the world type dump when this happens
pr0ton has quit [Ping timeout: 264 seconds]
yfeldblum has quit [Remote host closed the connection]
crdpink has joined #ruby-lang
elia has quit [Quit: Computer has gone to sleep.]
x0f has joined #ruby-lang
cfkoch has left #ruby-lang [#ruby-lang]
luiz_lha has joined #ruby-lang
weems|mac has quit [Quit: weems|mac]
saarinen has quit [Quit: saarinen]
banister_ has joined #ruby-lang
banister has quit [Ping timeout: 240 seconds]
mykoweb has joined #ruby-lang
yfeldblum has joined #ruby-lang
solars has quit [Ping timeout: 255 seconds]
diegoviola has quit [Quit: WeeChat 0.4.3]
sharpmachine has joined #ruby-lang
DivineEntity has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
llakey has quit [Ping timeout: 245 seconds]
willmarshall has joined #ruby-lang
paul_k has quit [Ping timeout: 245 seconds]
arBmind has quit [Quit: Leaving.]
banister_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pglombardo has quit []
llakey has joined #ruby-lang
cmhobbs has quit [Remote host closed the connection]
havenwood has quit []
loincloth has quit [Remote host closed the connection]
paul_k has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
elia has joined #ruby-lang
clauswitt has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
willmarshall has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]