Greg S
Joined
Activity
Posted in Deploy rails 7.2+
Getting Started with Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
Maybe because I'm not using VS Code, I had to do it differently
Posted in Deploy rails 7.2+
Your command will create an app named rails-version
the 7.2.0
is ignored, at least on my computer. Here's what I did
$ gem install rails
$ rails -v # to confirm 7.2.0
$ rails new my_rails_7.2_app \
--css=bootstrap \
--database=postgresql \
--asset-pipeline=propshaft \
--devcontainer
Created an app. Many Bootstrap errors and warnings, but otherwise seems OK. But I shouldn't have had to do the first step using devcontainer, so I am doing something wrong.
I'm a very amateur Rails user and only have hobby apps with low usage. I'm willing to pay for simplicity. I was OK with Heroku and was able to move the Postgres database back and forth from my Mac to Heroku as needed and not too many problems deploying. I've had more trouble with Fly.io.
That said, any good comparison sources to recommend?
It sounds as if you want to be current. So you might focus on getting Rails 7 and Ruby 3 installed. 'nokogiri' has frequently caused me issues like this—I never quite know what got it working again. Search for how to install Rails using rbenv. I don't use rbenv but it seems to be the most commonly used so should be solid. Good luck.
One old set of notes said these two commands worked.
brew install libxml2
bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/include/libxml2/
Maybe it's length:
Replying to self. I just copied the URL and got to the right page.
This walking through of how to set up AWS S3 was very helpful. I've done it before and sure I've made some (probably serious) errors.
How did you get to the Policy section on AWS?
As long as you use rails g stimulus new_controller_name
updates index.js
and create a controller.
Posted in Installing Tailwind with Rails 7
@Stéphane Paquet Makes sense. Fight Bootstrap or find a predefined kit. The one thing I don't like is that the HTML gets messier or longer anyway. Maybe better if my editor could collapse the 'class' on demand.
Maybe not a good answer. I ran into a problem upgrading to 3.1.2 and just rolled back to 3.0.2. Not the same problem as yours. My thinking was I didn't need the latest and that eventually the problem would be fixed. And I was on Rails 7, so would assume fewer issues. My notes:
Downgraded to ruby-3.0.2 because of visit_Psych_Nodes_Alias': Cannot load database configuration: (Psych::BadAlias) error on launch (https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias)
Posted in How do I find out why Stimulus controllers aren't getting compiled? Asset Pipeline problem
Not an answer, but I got it working by running rails assets:precompile
. Shouldn't this be part of Profile.dev
? or something like that?
Still curious about original question of how to see what is happening and what should happen.
Posted in How do I find out why Stimulus controllers aren't getting compiled? Asset Pipeline problem
I updated a Rails 6 app to Rails 7 and changed from Webpacker to esbuild/webpack. Added Stimulus, and after not getting controllers to work tried a basic hello_controller and then searched the application.js as seen in Chrome and no 'hello' or "Hello" I made a basic app to compare. I've toggled many settings and don't know where to look.
webpack.config.js
are identical. hello_controller.js is identical.
Beginning of Gemfile:
ruby '3.0.2'
gem "rails", "~> 7.0.4"
gem "sprockets-rails"
gem 'sassc-rails', '>= 2.0.1'
gem 'jsbundling-rails'
gem "cssbundling-rails", "~> 1.1"
gem 'turbo-rails'
gem 'stimulus-rails'
gem 'puma', "~> 5.0"
gem 'pg'
package.json
{
"license": "ISC",
"main": "application.js",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.12.1",
"@hotwired/stimulus": "^3.1.1",
"@hotwired/turbo-rails": "^7.0.0-rc.1",
"@popperjs/core": "^2.11.6",
"@rails/actiontext": "^6.0.0",
"@rails/ujs": "^6.0.1",
"bootstrap": "^5.2.2",
"bootstrap-icons": "^1.10.2",
"exiftool": "^0.0.3",
"imports-loader": "^0.8.0",
"jquery": "^3.4.1",
"jqueryui": "^1.11.1",
"leaflet": "^1.7.1",
"leaflet.timeline": "1.3.0",
"lodash": "^4.17.15",
"mapbox": "^1.0.0-beta10",
"ol": "^7.1.0",
"ol-ext": "^4.0.4",
"ol-layerswitcher": "^4.1.0",
"ol-loupe": "^1.0.1",
"ol-popup": "^5.0.0",
"rails-erb-loader": "^5.5.2",
"sass": "^1.56.1",
"stimulus": "^3.1.1",
"trix": "^1.0.0",
"webpack": "^5.75.0"
},
"devDependencies": {
"@prettier/plugin-ruby": "^0.22.0",
"prettier": "^2.2.1",
"webpack-cli": "^5.0.0"
},
"scripts": {
"build": "webpack --config ./webpack.config.js",
"build:css": "sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules"
}
}
command line server launch without timestamp
➜ bd
web.1 | started with pid 35879
js.1 | started with pid 35880
css.1 | started with pid 35881
js.1 | yarn run v1.22.19
css.1 | yarn run v1.22.19
js.1 | $ webpack --config ./webpack.config.js --watch
css.1 | $ sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules --watch
css.1 | Sass is watching for changes. Press Ctrl-C to stop.
css.1 |
web.1 | => Booting Puma
web.1 | => Rails 7.0.4 application starting in development
web.1 | => Run `bin/rails server --help` for more startup options
web.1 | Puma starting in single mode...
web.1 | * Puma version: 5.6.5 (ruby 3.0.2-p107) ("Birdie's Version")
web.1 | * Min threads: 5
web.1 | * Max threads: 5
web.1 | * Environment: development
web.1 | * PID: 35879
web.1 | * Listening on http://127.0.0.1:3000
web.1 | * Listening on http://[::1]:3000
web.1 | Use Ctrl-C to stop
js.1 | asset application.js 503 KiB [compared for emit] [minimized] [big] (name: application) 1 related asset
js.1 | orphan modules 2.58 MiB [orphan] 342 modules
js.1 | runtime modules 997 bytes 4 modules
js.1 | cacheable modules 1.75 MiB
js.1 | modules by path ./node_modules/ol/ 109 KiB
js.1 | modules by path ./node_modules/ol/*.js 74.9 KiB 18 modules
js.1 | modules by path ./node_modules/ol/layer/*.js 22.2 KiB 3 modules
js.1 | modules by path ./node_modules/ol/events/*.js 7.39 KiB
js.1 | ./node_modules/ol/events/Event.js 1.46 KiB [built] [code generated]
js.1 | + 2 modules
js.1 | ./node_modules/ol/control/Control.js 4.44 KiB [built] [code generated]
js.1 | ./node_modules/ol/extent/Relationship.js 200 bytes [built] [code generated]
js.1 | ./app/javascript/application.js + 224 modules 1.59 MiB [built] [code generated]
js.1 | ./node_modules/ol-layerswitcher/dist/ol-layerswitcher.js 23.5 KiB [built] [code generated]
js.1 | ./node_modules/@rails/actioncable/src/index.js + 9 modules 19.1 KiB [built] [code generated]
js.1 | ./node_modules/rbush/rbush.min.js 6.31 KiB [built] [code generated]
js.1 |
js.1 | WARNING in configuration
js.1 | The value 'hashed' for option 'optimization.moduleIds' is deprecated. Use 'deterministic' instead.
js.1 |
js.1 | WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
js.1 | This can impact web performance.
js.1 | Assets:
js.1 | application.js (503 KiB)
js.1 |
js.1 | WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
js.1 | Entrypoints:
js.1 | application (503 KiB)
js.1 | application.js
js.1 |
js.1 | WARNING in webpack performance recommendations:
js.1 | You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
js.1 | For more info visit https://webpack.js.org/guides/code-splitting/
js.1 |
js.1 | webpack 5.75.0 compiled with 4 warnings in 2885 ms
web.1 | Started GET "/" for ::1 at 2022-11-26 17:43:46 -0800
web.1 | ActiveRecord::SchemaMigration Pluck (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
web.1 | Processing by StaticPagesController#home as HTML
web.1 | Rendering layout layouts/application.html.erb
web.1 | Rendering static_pages/home.html.erb within layouts/application
web.1 | Rendered static_pages/home.html.erb within layouts/application (Duration: 1.1ms | Allocations: 1462)
web.1 | Rendered layouts/_header.html.erb (Duration: 2.7ms | Allocations: 4997)
web.1 | Rendered layouts/_footer.html.erb (Duration: 0.6ms | Allocations: 556)
web.1 | Rendered layout layouts/application.html.erb (Duration: 7.0ms | Allocations: 9376)
web.1 | Completed 200 OK in 10ms (Views: 8.2ms | ActiveRecord: 0.0ms | Allocations: 13007)
web.1 |
web.1 |
No console errors
Second the request for the "right" way to add another .css.
In particular I am using Leaflet.js and Leaflet adds some css.
I tried @import './node_modules/leaflet/dist/leaflet.css';
in application.bootstrap.scss
, but it doesn't work. Also confusing that this file isn't named application.scss
and then add the bootstrap specific css.
@PatJames
// /app/assets/stylesheets/application.scss
@import 'bootstrap';
// /app/assets/stylesheets/bootstrap.scss
@import 'bootstrap/scss/bootstrap';
// /app/javascript/application.js
// Entry point for the build script in your package.json
import "@hotwired/turbo-rails"
import "./controllers"
import * as bootstrap from "bootstrap"
I have been looking at Rails 7 and am now working on trying to upgrade an app using importmaps. In other words I don't have a big app working with esbuild. My notes on say what I put in above is based on https://www.bootrails.com/blog/rails-7-bootstrap-5-tutorial/.
Posted in How to Deploy Rails to Fly.io Discussion
PS. I'm not hurrying waiting for more tutorials and discussions. I've got a dozen tabs already opened to dig through.
Posted in How to Deploy Rails to Fly.io Discussion
Can't help with that, but am looking more into fly.io. It sets up the Docker automatically. I am having trouble deploying and have to dig further. With a Postgres db appears to be ⅓ the price of Heroku. If that is the case I might keep my three toy apps going.
Posted in How to Deploy Rails to Fly.io Discussion
Great. Sets up Docker which I didn't want to get into, so that's a great help. Trying it. Looks like $7/month with a Postgres db.
mini_exiftool
and exif
gems for meta tags. I found exif
less complete but faster. The gems use ExifTool (https://exiftool.org).
Read the history of JavaScript. It was written in two weeks (fact check needed) and it shows. But because browsers support it you can't change to another language for almost anything on the web. My simplified version.
Posted in Setup MacOS 12 Monterey Discussion
@jongwon. What happens if you add gem sqlite3
to your Gemfile and bundle install
?