Questions tagged [amber-framework]
Amber is an open source web application framework written in Crystal, a compiled, type safe language. Amber brings many of the benefits of type safety together with Rails-like MVC web application development.
22
questions
0
votes
1
answer
16
views
Amberframework Granite decimal number in model
I have a Rails application running Postgres with model containing decimal field.
Now I'm creating an Amber API with Granite.
How do I define a decimal field in my model in Crystal?
class User < ...
0
votes
1
answer
46
views
Crystal + Amber: "cannot find -lsqlite3 (this usually means you need to install the development package for libsqlite3)"
After running the command to install Ubuntu dependencies, I am still receiving the following error when trying to run a shards build:
/usr/bin/ld: cannot find -lsqlite3 (this usually means you need to ...
0
votes
0
answers
26
views
How do I change the cache-control header for my static assets in Amber?
I want to allow my static assets to be cached for a very long time, but am unsure how to change the cache-control response, and whether the router or the controller is the right place to do it.
1
vote
2
answers
117
views
Testing non public routes results in KeyError
i am new to Crystal and Amber and i have an Issue with testing non public routes. I used the Amber authentication generator and afterwards geneated a scaffold for a Job entity and added related routes ...
0
votes
1
answer
69
views
Save empty strings as NULL in the database. AmberFramework / Granite
It is possible to force Granite to save empty strings as NULL in the DB?
I tried this code:
before_save :nilify_blanks
def nilify_blanks
self.to_h.keys.each do |column|
if self[column].is_a?(...
3
votes
2
answers
113
views
Created Expected created to be (Time | Nil) but got (Float64 | String)
I am new to this amber framework,crystal lang and object oriented programming in general . I was following the tutorials and tried to create a simple form using this scaffold
amber g scaffold item ...
0
votes
1
answer
57
views
Is therre any crystal coding style to prevent nil error in compiling
I am a newbie of crystal and amber framework, and when I try to rewrite a rails app with db to amber, I encountered a lot of compile error complained about nil matching, even sometime it is clearly ...
0
votes
1
answer
48
views
instance var of CategoryController must be (Array(Array(Array(Int64 | String) | Array(String))) | Nil)
unable to store data contain in abc.
it's showing an error
instance variable @ar of CategoryController must be (Array(Array(Array(Int64 | String) | Array(String))) | Nil), not Array(Array(Int64 | ...
0
votes
1
answer
38
views
collection dropdown default blank value
how to add default blank value in select field (amber framework)?
== select_field(name: "parent_category_id", collection: Category.all.map{|category| [category.id, category.name]}, selected: "", ...
1
vote
1
answer
69
views
Records all delete when I restart `amber watch`
This is really strange and I've never encountered a bug like this.
I run amber db seed and my records are created, I can see my records in the UI, a simple index scaffold.
Then ctrl+c the amber ...
0
votes
1
answer
129
views
Can not make websocket connection with Amber or NPM not sure which
Amber CLI (amberframework.org) - v0.11.3
Crystal 0.27.0 [c9d1eef8f] (2018-11-01)
LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu
npm 3.5.2
I am trying to implement sockets with Crystal Lang and ...
1
vote
1
answer
198
views
How to upgrade amber framework?
my crystal version is 0.26.1
my amber version is 0.7.2
I would like to upgrade my amber framework installation to the latest stable version (currently 0.9.0). What is the best way to do it? Thanks
1
vote
0
answers
92
views
Amber Crecto: preload association with LEFT JOIN
I have 2 models: Task and TaskLimit. Task belongs to TaskLimit. But task_limit_id might be Nil, so I need to use LEFT JOIN to preload existing TaskLimit's.
The only way I can do join is this:
query = ...
1
vote
0
answers
115
views
Deploying Amber to Heroku
TL;DR Amber (Granite ORM) is having issues figuring out which driver to use for the Postgres schema.
I have an application I recently deployed to Heroku. Following the docs, I could get the default ...
0
votes
0
answers
54
views
Amber framework : url_for in rails?
Is there something like url_for in rails to implement:
url_for controller: CONTROLLER, action: ACTION, arg_1: ARG1, arg_2: ARG2 generates link /CONTROLLER_PATH/ACTION?arg_1:ARG1&arg_2:ARG2?
0
votes
1
answer
199
views
Error in build procces in webpack
Well I'm using amberframework and it have built-in webpack building the issue is that when I'm trying to import an image via scss it can't handle the image file and can't find as I understand it.
The ...
1
vote
1
answer
147
views
Any real-life example for Amber's Auth?
Basically all the guides show you how to use the generator to create a basic authentication system. But in real life there may be a need to add other fields to the user such as first_name, last_name, ...
1
vote
1
answer
108
views
VUEjs in AMBER embedded
I want to use VUEjs with amber together. is this possible? Can I integrate the vue webpack to my amber application and use vue in my amber app?
1
vote
0
answers
156
views
Granite ORM + fiber + mysql = Unexpected EOF (Exception)?
Is working with Fibers in Granite possible? I didn't have a reason to believe otherwise, until I attempted to write some code for it. I am attempting to learn to work with Fibers, so perhaps ...
3
votes
2
answers
339
views
Customizing the generated SELECT in a query? [Granite ORM]
I'm trying build a JOIN query in Amber (using the Granite ORM) on a legacy database (with existing data & table structure), and wondering if it's possible to customize the SELECT FROM portion of ...
6
votes
1
answer
430
views
How to Deploy an Amber App on Ubuntu?
Just discovered Amber...looks nice! How can I deploy a sample App on an Ubuntu Server? Should it be done just like Rails, routing the path to public? Or some other part of the structure?
Thanks for ...
8
votes
2
answers
551
views
Declare type of instance variable on controller
I have a crystal-lang project on Amber framework with Jennifer.cr and I'm getting this error on my controller:
Can't infer the type of instance variable '@companies' of CompanyController
@companies = ...