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
_whitelogger has joined #amber
<FromGitter> <renich_gitlab> /help
<FromGitter> <renich_gitlab> > I have a bit of an issue with my relational DB: ⏎ > ⏎ > ```sh ⏎ > amber generate scaffold Referrer name url ⏎ > amber generate scaffold Venue logo picture name description phone email url ... [https://gitter.im/amberframework/amber?at=601ed217ae4b9b27c1a3c6d1]
alexherbo2 has joined #amber
<FromGitter> <Blacksmoke16> its an unrelated error, from a diff model
<FromGitter> <renich_gitlab> I've tried: `unless @title.is_nil?` and it didn't work either.
<FromGitter> <renich_gitlab> Ah, wait, yeah. I get what you said @Blacksmoke16
<FromGitter> <renich_gitlab> Removed the offending block, started watch (so it recompiles) and will try again
<FromGitter> <renich_gitlab> Yep, the example works...
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <renich_gitlab> I have this: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ Date shouldn't be Nil... ever. Why is it? [https://gitter.im/amberframework/amber?at=601eea4aa0246860dc37737f]
<FromGitter> <Blacksmoke16> all ivars in granite models are nil under the hood
<FromGitter> <Blacksmoke16> try `self.date`
<FromGitter> <renich_gitlab> OK
<FromGitter> <Blacksmoke16> then it'll use the not nilable getter
<FromGitter> <renich_gitlab> this worked: `@date = Time.parse!("#{self.date}", "%F")`
<FromGitter> <renich_gitlab> Thanks a lot!
<FromGitter> <Blacksmoke16> hows that even work, isnt `self.date` already a `Time`?
<FromGitter> <renich_gitlab> I meant it compiled...
<FromGitter> <renich_gitlab> My problem is this:
<FromGitter> <Blacksmoke16> whats the request look like? i.e. what is the form sending the server?
<FromGitter> <renich_gitlab> I'm using a date type input and, when I try to put that into a Datetime column in postgres, the model complains because it doesn't have a converter, I believe.
<FromGitter> <renich_gitlab> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=601eebd2428d9727dd5d38a2]
<FromGitter> <renich_gitlab> So, date is a string. It has to be converted to Time, right?
<FromGitter> <Blacksmoke16> right, but why does it think its an `Int64`?
<FromGitter> <Blacksmoke16> id think you want to convert the value *before* you create your model tho
<FromGitter> <renich_gitlab> No idea...
<FromGitter> <renich_gitlab> OK, so, do that in the controller?
<FromGitter> <Blacksmoke16> im not super familiar with Amber, but id check if the problem is going from form data to model, or model to db
<FromGitter> <Blacksmoke16> i.e. before saving the model print it out and see if the date ivar is set to what it should be
<FromGitter> <renich_gitlab> OK, I'll do that.
alexherbo2 has quit [Ping timeout: 272 seconds]
alexherbo2 has joined #amber
alexherbo26 has joined #amber
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo26 is now known as alexherbo2
<FromGitter> <renich_gitlab> oh ,man, I cannot make that input work. It seems I cannot use Datetime in a model...
alexherbo28 has joined #amber
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo28 is now known as alexherbo2
<FromGitter> <renich_gitlab> OK, if anyone here could help me. How would you go about adding an input type `date` and posting it to a controller that will put it in a model with a column of type `Time?`? ⏎ ⏎ For example, I would want to register a date for an event. ⏎ ⏎ Right now, my model complains: ... [https://gitter.im/amberframework/amber?at=601f1f4b84e66b7f7ed8720b]
<FromGitter> <renich_gitlab> MY params were: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/amberframework/amber?at=601f1f6132e01b4f717cf434]
<FromGitter> <renich_gitlab> I'm using granite, btw.
<FromGitter> <Blacksmoke16> Can you reproduce it without amber? I.e just try to instantiate the model manually with the data that's coming into the endpoint
<FromGitter> <eliasjpr> You must parse the string date into a Time object
<FromGitter> <eliasjpr> And pass the Time object to your model
<FromGitter> <eliasjpr> Time.parse("2015-10-12 10:30:00 +00:00", "%Y-%m-%d %H:%M:%S %z", Time::Location::UTC)
<FromGitter> <eliasjpr> Time.parse("2015-10-12 10:30:00 +00:00", "%Y-%m-%d %H:%M:%S %z", Time::Location::UTC)
alexherbo2 has quit [Ping timeout: 256 seconds]