Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 17 18:49
    drujensen commented #1131
  • Aug 17 18:49
    drujensen closed #1131
  • Aug 17 18:49
    drujensen commented #1131
  • Aug 17 18:43

    drujensen on v0.17.2

    (compare)

  • Aug 17 18:42

    drujensen on master

    Fix conversion errors (compare)

  • Aug 17 18:42

    drujensen on master

    Bumped version number to v--hel… (compare)

  • Aug 17 18:40

    drujensen on master

    Handle string conversion & conv… (compare)

  • Aug 17 18:40
    drujensen closed #357
  • Aug 17 18:40
    drujensen closed #356
  • Aug 17 17:58
    Blacksmoke16 labeled #357
  • Aug 17 17:54
    Blacksmoke16 opened #357
  • Aug 17 17:54
    Blacksmoke16 labeled #357
  • Aug 17 17:13
    Blacksmoke16 commented #356
  • Aug 17 17:13
    Blacksmoke16 commented #356
  • Aug 17 16:06

    drujensen on snap-support

    requested the name from snapcr… (compare)

  • Aug 17 15:23

    drujensen on snap-support

    add snapcraft deployment support (compare)

  • Aug 17 15:18
    drujensen commented #356
  • Aug 17 03:28
    drujensen commented #356
  • Aug 17 03:27
    drujensen commented #356
  • Aug 17 03:20
    drujensen commented #356
Blacksmoke16
@Blacksmoke16
try like sudo snap refresh crystal --channel 0.29.0/stable?
naw that wont work
shortly-portly
@shortly-portly
Hi - this may seem like a silly question but where can I find the amber api documentation (I've read the guides and now what to look at the api). cheers
Blacksmoke16
@Blacksmoke16
could just download an older binary from github releases and use that
Nathaniel Suchy
@nsuchy
I want to use snaps though
or really
I want to know what the heck happened to my amber binary
Blacksmoke16
@Blacksmoke16
:shrug:
Nathaniel Suchy
@nsuchy
uninstalling it and installing from npm
gonna see if that version works better
okay yeah no
that failed
lol
Welcome to Amber CLI version 0.101.0 (Amber 0.18.5, NodeJS 10.15.2).
Available commands
config
help
init
repl
serve
version
Sam Johnson
@sam0x17
how to completely disable node / webpack in amber? I'm making an API server and dont need any assets
Sam Johnson
@sam0x17
I figured it out
its actually very easy to strip a lot of things out without breaking amber
Damian Hamill
@damianham
@shortly-portly all the amber documentation is in the online guides - what you probably want is the API documentation for the crystal language https://crystal-lang.org/api/0.30.1/
Elias Perez
@eliasjpr
@ikaru5 I haven’t made any progress with that cause amber can be organized as you want really. Just need to create directories following the trailblazer pattern and making the right requires
shortly-portly
@shortly-portly
Thanks @damianham - I might be missing something but I wanted the Amber API i.e. what does the call to validate! vs validate look like - the stuff generated by crystal docs For example the Kemal framework has a website and an API Site (https://kemalcr.com/docs/).
shortly-portly
@shortly-portly
Hi Al. Is there a mistake in the guide for param validation or am I misunderstanding (I'm very new to Crystal and Amber). According to the guide the following should work
      required(:name, "Your First Name is missing!") { |p| p.name? & !p.name.empty? }
but it fails as required is expecting p to be the param field (in this case name) not p.name? Am I right or just misunderstanding? cheers
Dru Jensen
@drujensen
it’s calling the block with the params[@field]
shortly-portly
@shortly-portly
Thanks @drujensen - I'm assuming the documentation rather than the code is wrong - I'll check to see if an issue has been raised and if not I'll raise one.
Damian Hamill
@damianham
I am in the process of upgrading to 0.30 and I am getting this error
 01:04:55 Error: 500 | (ERROR) Exception SQLite3::ResultSet#read returned a Nil. A String was expected. lib/db/src/db/result_set.cr:0:9 in 'read'
 lib/granite/src/granite/type.cr:20:3 in 'from_rs'
 lib/granite/src/granite/columns.cr:37:5 in 'from_rs'
 lib/granite/src/granite/querying.cr:9:5 in 'from_rs'
 lib/granite/src/granite/querying.cr:17:17 in 'raw_all'
 lib/granite/src/granite/querying.cr:32:30 in '->'
 lib/granite/src/granite/collection.cr:255:3 in 'collection'
 lib/granite/src/granite/collection.cr:0:5 in 'Granite::Collection(Configuration)'
 lib/granite/src/granite/querying.cr:37:5 in 'first'

# called from a method in Configuration class
  self.first("where profile = ? and path = ?",["default", "some.path.that.may.exist"])
Blacksmoke16
@Blacksmoke16
whats your model look like
Damian Hamill
@damianham
well that actually comes from a mixin
class Configuration < Granite::Base
  extend ModelProfile
  connection sqlite
  table configurations

  column id : Int64, primary: true
  column profile : String
  column path : String
  column value : String
  column ftype : String
  column unit : String
  column options : String

  def self.enabled(path : String)
    rec = for_path(path)
    rec && (rec.value == "Yes" || rec.value == "yes")
  end
end

module ModelProfile
  def for_profile(profile : String, query ="", params = [] of DB::Any)
    if /where/i =~ query
      query = query.gsub(/where/i, " where profile = ? and ")
      res = self.all(query, [profile] + params)
    else
      res = self.all("where profile = ? "+query, [profile] )
    end
    res
  end

  def current(clause = "", params = [] of DB::Any)
    profile = SmartBox::Lib::Configuration.current_profile
    for_profile(profile, clause, params)
  end

  def for_path(path : String)
    profile = SmartBox::Lib::Configuration.current_profile
    self.first("where profile = ? and path = ?",[profile, path])  # this line here is where the exception is raised
  end

  def is_enabled?(path : String)
    rec = for_path(path)
    rec && rec.enabled
  end

  def where(clause = "", params = [] of DB::Any)
    current(clause, params)
  end
end
Blacksmoke16
@Blacksmoke16
none of your columns are nilable
so there is prob a null value in db, hence the error
Damian Hamill
@damianham
ah Ok thanks - I presume this is a change for 0.30 - is it in the changelog ?
was a Granite thing
Damian Hamill
@damianham
I would change
a column can be declared as Nilable using ?
# to
if a column can be null it must be declared as Nilable using ?  e.g. column something : String?
Blacksmoke16
@Blacksmoke16
  column name : String? # Nilable field
  column body : String # Not nil field
is that not good enough in the example?
Damian Hamill
@damianham
yeah... don't worry - I'm a tit that reads too fast :)
Blacksmoke16
@Blacksmoke16
:p np
Damian Hamill
@damianham
thanks for help - it's appreciated
Blacksmoke16
@Blacksmoke16
np
Nathaniel Suchy
@nsuchy
Considering switching my shards.yml away from master and back to tagged releases
I like being on the edge but at same time one server restart and a granite change is enough to cause crystal edge to repull from snapcraft and break everything
:|
Blacksmoke16
@Blacksmoke16
well yea thats kinda the point of locking your dependencies :P
Nathaniel Suchy
@nsuchy
heh
:D
Blacksmoke16
@Blacksmoke16
you can also lock by commit btw
Nathaniel Suchy
@nsuchy
If anyone here wants to chime in: gitlab-org/project-templates/contributing#2
ikaru5
@ikaru5
Does anyone know a guide or an example project for writing controller tests?