desnudopenguino has quit [Ping timeout: 256 seconds]
desnudopenguino1 is now known as desnudopenguino
markong has joined #ruby
Pixi has quit [Ping timeout: 240 seconds]
John_Ivan has joined #ruby
Pixi has joined #ruby
markong has quit [Ping timeout: 240 seconds]
roadie` has quit [Ping timeout: 248 seconds]
ua_ has quit [Ping timeout: 246 seconds]
shokohsc2 has joined #ruby
shokohsc has quit [Ping timeout: 250 seconds]
shokohsc2 is now known as shokohsc
moldorcoder7 has quit [Ping timeout: 256 seconds]
donofrio has joined #ruby
donofrio has quit [Ping timeout: 250 seconds]
roadie` has joined #ruby
roadie` has quit [Ping timeout: 248 seconds]
donofrio has joined #ruby
roadie` has joined #ruby
roadie` has quit [Ping timeout: 248 seconds]
John_Ivan has quit [Ping timeout: 256 seconds]
donofrio has quit [Ping timeout: 250 seconds]
_ht has joined #ruby
jhass has quit [Ping timeout: 240 seconds]
donofrio has joined #ruby
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 246 seconds]
desnudopenguino1 is now known as desnudopenguino
jhass has joined #ruby
polishdub has quit [Ping timeout: 250 seconds]
donofrio has quit [Ping timeout: 250 seconds]
polishdub has joined #ruby
roadie` has joined #ruby
roadie` has quit [Ping timeout: 248 seconds]
comet23 has joined #ruby
grenierm has joined #ruby
roadie` has joined #ruby
roadie` has quit [Ping timeout: 248 seconds]
_ht has quit [Remote host closed the connection]
cagey31 has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
roadie` has joined #ruby
roadie` has quit [Client Quit]
roadie has joined #ruby
yosafbridge has quit [Quit: Leaving]
friendlypunk has joined #ruby
yosafbridge has joined #ruby
Mahfuj has joined #ruby
<Mahfuj>
Hello Everyone!
<Mahfuj>
Seareed Inc. is seeking a skilled and passionate developer to join our dynamic e-commerce platform. If you are an experienced professional who thrives in a deadline driven, and fast-paced environment, and who has a strong background in web development, this is an excellent opportunity to contribute to the growth and success of our platform. At Seareed, we value creativity, innovation, and a passion for delivering exceptional user experiences. If you are
<Mahfuj>
excited about joining a dynamic team and making a significant impact on the future of our e-commerce platform. Our technical requirements includes doing many payment integrations, but the main framework is Stripe. Pay range 40 USD -100 USD per hour depending on skills, and experience. Please email me resume, portfolio, your relevant experience and why you are interested in this position at reazmahfuj124@gmail.com. We look forward to hearing from you!
teclator has joined #ruby
grenierm has quit [Quit: Client closed]
grenierm has joined #ruby
otisolsen70 has joined #ruby
comet23 has quit [Ping timeout: 245 seconds]
grenierm has quit [Ping timeout: 245 seconds]
ua_ has joined #ruby
infinityfye has joined #ruby
crespire has joined #ruby
crespire1 has quit [Ping timeout: 256 seconds]
roadie has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.0.91)]
<panella32>
Surprisingly Movie.joins(:movie_people) works but MoviePeople.joins(:movies) not! Any idea? (There's a one-to-many relationship between them)
<panella32>
Error Can't join 'MoviePerson' to association named 'movies'; perhaps you misspelled it?
<panella32>
>> ActiveRecord::Base.connection.execute("SELECT movie_people.* FROM movie_people INNER JOIN movies ON movie_people.movie_id = movies.id") also works!
DoxYourselfNow has quit [Remote host closed the connection]
<panella32>
There's a similar issue with another association somewhere else. Let me try this trick to see it also works there or not..
micah has joined #ruby
<panella32>
It worked but I now I have another issue.
<micah>
How do I test if a variable is true or false? I want to do an action if one of those states exist, but if its not set, then i dont want to do the action
<panella32>
micah I think there would be a predicate method by default for all boolean variables. obj.foo? # true/false
donofrio has quit [Ping timeout: 240 seconds]
donofrio has joined #ruby
<micah>
so will this work:
<micah>
def foo(reason = nil)
<micah>
if reason
<micah>
puts "set"
<micah>
end
<micah>
end
<mooff>
micah, that should indeed work
markong has joined #ruby
<mooff>
you can also: puts "set" if reason
Sankalp has joined #ruby
<mooff>
note that the only values which aren't considered truthy are nil and false
<mooff>
= puts "wow, all true!" if [] and {} and 0 and ""
<ruby-eval>
(eval):1: warning: string literal in condition
<ruby-eval>
wow, all true!
<ruby-eval>
=> nil
<panella32>
considering this erd (https://i.imgur.com/RpGtTRZ.png) could you tell me why the select part of the following query does not work as intended?
<panella32>
why isn't 'people.name' presented in the result?
<panella32>
Maybe both selected columns have same name "name"?
reset has quit [Quit: reset]
<adam12>
panella32: Likely.
<adam12>
panella32: Maybe try `roles.name AS role_name`
<adam12>
I don't know if that works in ActiveRecord.
szkl has joined #ruby
aindilis has quit [Ping timeout: 268 seconds]
aindilis has joined #ruby
tomtmym has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
otisolsen70 has quit [Quit: Leaving]
pounce has joined #ruby
meimei has joined #ruby
johnjaye has quit [Ping timeout: 268 seconds]
<panella32>
That syntax seems to be valid because the equivalent sql command does include the alias you defined but the result is still not as expected. For some reason I could select either people.name or roles.name, not both at the same time..
John_Ivan has joined #ruby
Pixi` has joined #ruby
Pixi has quit [Ping timeout: 256 seconds]
<panella32>
adam12 the query actually works inside the app and both attributes are accessible via their alias names, although the appeared result on the the console (https://imgur.com/a/o9xd9s8) seems to be incomplete.
<panella32>
So it solved and thank you, time to move on.
<adam12>
panella32: You'd probably need to access it via the square bracket I think.
<adam12>
person[:role_name] or something
<adam12>
Oh, nevermind. Sounds like you solved it.
smp_ has joined #ruby
smp has quit [Ping timeout: 265 seconds]
smp_ is now known as smp
<panella32>
Yes it solved. Both dot notation and square bracket notation are working here as expected, both inside the app or in the console. The only thing I still don't understand is why the result of the query (shown in the console) is incomplete! Even though they actually exist but the console tries its best to hide them unless I use dot/square bracket notations to access them manually. Please check out these 2 screenshots https://imgur.com/a/m3Yhn5Q
<panella32>
The 2nd image seems to be deceptive, because the shown result is not as expected.I thought my query was wrong but it was correct, from now on I try not to count too much on the results that appear on the console!
szkl has quit [Quit: Connection closed for inactivity]
panella32 has quit [Ping timeout: 246 seconds]
<adam12>
panella32: That's natural. ActiveRecord constructs a model by looking at the columns on the table. Your query is returning columns that don't exist on the table.
panella32 has joined #ruby
<panella32>
considering an Arel like this ["John Smith":"Writer", "John Smith":"Director", ...] possible to "group_by" it in order to look like this: ["John Smith": "Writer,Director"]. Hard to group_by, isn't it?
<panella32>
(it's another div but with same issue)
tomtmym has quit [Quit: Gone.]
markong has joined #ruby
nona has quit [Quit: WeeChat 3.8]
panella32 has quit [Ping timeout: 265 seconds]
panella32 has joined #ruby
cek has quit [Quit: Connection closed for inactivity]
kaivai has joined #ruby
donofrio has joined #ruby
John_Ivan has quit [Quit: Disrupting the dragon's slumber one time too often shall eventually bestow upon all an empirical and indiscriminate conflagration that will last for all goddamn eternity.]