ruby-on-rails-6

Vanilla Rails 6.0: “error Command ”webpack“ not found”

江枫思渺然 提交于 2019-12-05 07:49:51
System: Ruby: 2.6.3p62 (rvm) Rails: 6.0 OS: macOS 10.14.6 Setup A fresh Rails 6.0 application: $ rails new testshop2 $ cd testshop2 $ rails g controller Page index $ rails s => Booting Puma => Rails 6.0.0 application starting in development => Run `rails server --help` for more startup options Puma starting in single mode... * Version 3.12.1 (ruby 2.6.3-p62), codename: Llamas in Pajamas * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://localhost:3000 Use Ctrl-C to stop When I browse to ` http://localhost:3000/page/index ' the system throughs this error: Started

Rails 6: Only one profile per user should be created

女生的网名这么多〃 提交于 2019-12-01 14:41:47
I'm currently working on a Rails 6 application. I have the following association. A User has a Profile and a Profile belongs to a User. When editing a profile for a user I ended up having two profiles for the user. I would like to have only one profile per user. Edit form: profile/edit.html.erb <%= form_for @profile do |f| %> <div class="form-group"> <%= f.label :avatar %> <%= f.file_field :avatar, as: :file, class: "form-control" %> </div> <div class="form-group"> <%= f.label :full_name, 'Full Name' %> <%= f.text_field :full_name, autofocus: true, class: "form-control" %> </div> <div class=

Webpacker throws application.css not found in manifest.json in *Rails 6* application

你。 提交于 2019-12-01 07:40:27
问题 Currently we use Rails 6 for our application. It's working fine in production but in development mode it throws some errors. Please assist me. This is how my application.js and application.css looks like packs/application.js require("@rails/ujs").start() require("turbolinks").start() require("@rails/activestorage").start() require("channels") require("jquery") import '../stylesheets/application' import './bootstrap_custom.js' import './side_menu.js.erb' //import './sweetalert.js' import '.

How to require custom JS files in Rails 6

佐手、 提交于 2019-12-01 03:40:34
I'm currently trying Rails 6.0.0.rc1 which seems to have moved the default javascript folder from app/assets/javascript to app/javascript . The application.js file is now located in app/javascript/packs . Now, I want to add a couple of js files, but for some reason they don't get imported and I can't find any documentation on how this can be done in Rails 6. I tried a couple of things: Create a new folder custom_js under app/javascript/packs , putting all my js files there and then add a require "custom_js" to application.js . Copy all my js files under app/javascript/channels (which should be