faustinoaq changed the topic of #amber to: Welcome to Amber Framework community! | https://amberframework.org | Developer happiness, productivity and bare metal performance | GH: https://github.com/amberframework | Docs: https://docs.amberframework.org | Gitter: https://gitter.im/amberframework/amber | IRC Logger: https://irclog.whitequark.org/amber | Amber::Server.start
<FromGitter> <Blacksmoke16> `in lib/CrSerializer/src/CrSerializer/json/to_json.cr:15: no overload matches 'Granite::Base#to_json' with types JSON::Builder, Array(String), Array(String)` 😕
<FromGitter> <Blacksmoke16> this makes no sense
<FromGitter> <Blacksmoke16> im serializing another model just fine
<FromGitter> <Blacksmoke16> ogh ill worry about it tomorrow
_whitelogger has joined #amber
_whitelogger has joined #amber
feepbot has quit [Ping timeout: 250 seconds]
feepbot has joined #amber
<FromGitter> <mixflame> Hello all, I'm back
<FromGitter> <Blacksmoke16> o/
<FromGitter> <rmarronnier> Hi all ! I'm having fun with amber, but I'm wrestling with Granite and relationships. I'm trying to apply what I read at : https://docs.amberframework.org/granite/docs/relationships
<FromGitter> <rmarronnier> Especially this part : 'team = Team.find 1 ⏎ ⏎ #has_one side.. ⏎ ⏎ puts team.coach ... [https://gitter.im/amberframework/amber?at=5c6f22f7a378ef11f61acd46]
<FromGitter> <rmarronnier> sorry for the messy markup :-/
<FromGitter> <Blacksmoke16> use three ```
<FromGitter> <rmarronnier> ok thanks :-)
<FromGitter> <Blacksmoke16> but whats the issue? getting an error or just trying to understand what each thing is doing?
<FromGitter> <rmarronnier> I'm getting this error : '''app_1 | in src/controllers/user_controller.cr:26: undefined method 'pair=' for User ⏎ app_1 | ⏎ app_1 | user.pair = pair'''
<FromGitter> <rmarronnier> And I've declared this : '''class Pair < Granite::Base ⏎ adapter pg ⏎ table_name pairs ⏎ ⏎ belongs_to :user''' [https://gitter.im/amberframework/amber?at=5c6f2399c4da4a11f593be9d]
<FromGitter> <rmarronnier> and : ''' class User < Granite::Base ⏎ include Crypto ⏎ adapter pg ⏎ table_name users ⏎ ... [https://gitter.im/amberframework/amber?at=5c6f23c2a7d733509da4d7c3]
<FromGitter> <Blacksmoke16> you would have to add a `has_one :pair` in your `User` model to get the `pair=` method
<FromGitter> <Blacksmoke16> but if a user can have many pairs, hrm
<FromGitter> <rmarronnier> So what you mean the has_many doesn't generate methods ?
<FromGitter> <Blacksmoke16> i dont think it does
<FromGitter> <Blacksmoke16> at least not a setter
<FromGitter> <Blacksmoke16> so prob have to do it the other way, `pair.user = user`
<FromGitter> <Blacksmoke16> then that way you could assign multiple pairs to the same user that would get returned on your `user.pairs` call
<FromGitter> <rmarronnier> hmm... Thanks, I'm going to try this
<FromGitter> <Blacksmoke16> np, yea associations are so confusing
<FromGitter> <Blacksmoke16> just in general, having to think about how everything is related
<FromGitter> <rmarronnier> Yeah, Inever though conceptualizing 'being a friend of' in SGBD would be so complex :D