<FromGitter>
<sam0x17> anyone have a neat redirect-http-to-https thing I can throw in as a before filter or routing rule in amber?
<FromGitter>
<Blacksmoke16> no easier to use nginx or something?
<FromGitter>
<sam0x17> somewhere in the chain there actually is nginx but I have no idea how to get at it's configuration as I'm behind docker elastic beanstalk
<FromGitter>
<sam0x17> in rails it's just `config.force_ssl = true`
<FromGitter>
<ninjapanzer> Morning, wanted to support the project monetarily but saw this over on librepay `Cannot be renewed because the account of the recipient isn't ready to receive new payments.`
<robacarp>
@sam0x17 if you're using aws, just do it on the elb
<robacarp>
the elb is free when it's attached to something, and you can do 301s there all day
<FromGitter>
<sam0x17> yeah you are right
<FromGitter>
<sam0x17> @Sija do you have an example of how to set raven.cr to capture errors in amber? Or should it work out of the box if DSN is set
<FromGitter>
<drum445> when I do a find_by on user, I get a user object back correctly, but it doesn't have a game array
<FromGitter>
<Blacksmoke16> did you call `.game` on it?
<FromGitter>
<Blacksmoke16> id do like `has_many :games, class_name: Game`
<FromGitter>
<Blacksmoke16> then `user.games`
<FromGitter>
<drum445> okay, I get something back `<Granite::AssociationCollection(User, Game)...`
<FromGitter>
<drum445> is this an iterable?
<FromGitter>
<Blacksmoke16> it lazily executes your query
<FromGitter>
<Blacksmoke16> so like `.each` or `.to_a` would execute the query then
<FromGitter>
<drum445> ah perfect, that got it
<FromGitter>
<drum445> thanks
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<drum445> was this orm library inspired by another one?
<FromGitter>
<Blacksmoke16> :shrug:
<FromGitter>
<drum445> what do you call your class names?
<FromGitter>
<drum445> `UserRepo` ?
<FromGitter>
<Blacksmoke16> `User`
<FromGitter>
<drum445> or just `User`
<FromGitter>
<Blacksmoke16> i call them what a single row in the database would be
<FromGitter>
<Blacksmoke16> `Post` and table `posts`
feepbot has quit [Ping timeout: 264 seconds]
<FromGitter>
<drum445> makes sense, cheers. And do you just add normal business logic to those classes, or have them as single purpose for DB interactions?
<FromGitter>
<Blacksmoke16> depends on the logic
<FromGitter>
<Blacksmoke16> like say you have a `Customer` model that has various fields that determine if that customer is "active"
<FromGitter>
<Blacksmoke16> then you could ofc define a like `.active?` method on it to abstract that logic
feepbot has joined #amber
<FromGitter>
<Blacksmoke16> but id try to avoid putting too much in there that doesnt exactly fit in
<FromGitter>
<Sija> @sam0x17 I’m afraid that missing file names and line numbers are related to compiling with `—production` flag set, see do they get reported when compiled without it
<FromGitter>
<drum445> Thanks for your hepl again @Blacksmoke16, think I'll stick with Granite for my Ruby Active Record alternative 👍
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<drum445> another question sorry, is it possible to perform a query in one find_by but across two tables, something like `User.find_by(user_id: user_id, post.category: "test" )`
<FromGitter>
<drum445> which would be ⏎ `select * from users inner join posts on posts.user_id = user.id where users.id = '1234' and posts.category = 'test';`
<FromGitter>
<drum445> and I'd want a user object to be returned, with one entry in the posts array
<FromGitter>
<drum445> that works, but I imagine that will be making two db calls :(
<FromGitter>
<Blacksmoke16> this is essentially STI
<FromGitter>
<Blacksmoke16> which granite doesnt support atm
<FromGitter>
<drum445> STI?
<FromGitter>
<Blacksmoke16> single table inheritence
<FromGitter>
<drum445> ah
<FromGitter>
<Blacksmoke16> in this case tho, might be able to do like `User.first("inner join posts on posts.user_id = user.id where users.id = '1234' and posts.category = 'test'")`
<FromGitter>
<Blacksmoke16> no idea if that would work
<FromGitter>
<drum445> yeah, that seems to have worked
<FromGitter>
<drum445> n1, although as I'm only using a foreign key atm I can just do `Post.find_by!(user_id: user_id, category: "test")`
<FromGitter>
<drum445> not really ideal as I want a user object and only works as the post table has user_id, will probably use the explicit SQL for now then, ta
<FromGitter>
<Blacksmoke16> if/when STI is enabled, idea is you would have some abstract model that defines common stuff and children for each specific type
<FromGitter>
<Blacksmoke16> then you could do like `TestPost.find` which would add a like `type = 'test'` behind the scenes
<FromGitter>
<drum445> ah right, that's what activerecord uses I believe