ruby-on-rails-6

jquery events not firing using webpacker and coffeescript

放肆的年华 提交于 2020-01-24 18:06:30
问题 Trying to build a new rails 6 application from scratch to replace a rails 5.2 application. Trying to use webpacker with foundation-site jquery and coffeescript After a bunch of searching I've got everything loaded with webpacker. It appears to be very (maybe too) flexible in that examples use different approaches. Everything works (foundation does x-grid, callouts etc, jquery loads and I can log jquery objects, coffeescript compiles) except jquery events don't seem to fire or build a listener

Rails 6 Active Storage : Could not find or build blob: expected attachable, got nil

只愿长相守 提交于 2020-01-24 15:49:05
问题 Just created a new Rails 6 app, and I am trying to allow adding images to an active_storage blob instead of replacing them, through a form generated with rails scaffold. Followed the documentation (https://guides.rubyonrails.org/active_storage_overview.html#has-many-attached), using #attach into my controller, but it leads to an error page and keep the "default" behavior of replacing all the images instead of adding new images. Using Rails 6.0.0 with active_storage 6.0.0 I first made a Page

Bootsnap::LoadPathCache::FallbackScan - cannot load such file — bindex

回眸只為那壹抹淺笑 提交于 2020-01-24 00:35:53
问题 When I run rails s , it throws me cannot load such file -- bindex error. I tried gem install bindex , it throws me the same error, tried bundle update - the same error, tried gem update - the same error. I have no idea how to fix this. macos mojave 10.14.5 rails 6.0.o.rc1 ruby 2.6.1 result of rails s app_7 ⮀ ⭠ master± ⮀ rails s => Booting Puma => Rails 6.0.0.rc1 application starting in development => Run `rails server --help` for more startup options Exiting Traceback (most recent call last):

Rails 6 ActionText rich_text_area works normally, does not appear when rendered in a layout

独自空忆成欢 提交于 2020-01-16 16:58:14
问题 I'm rendering a form that utilizes the ActionText input rich_text_area, which is the Rails implementation of the Trix WYSIWYG rich text editor. It's been working fine until I started refactoring my views to use a layout, where the form content can yield different forms. The form renders fine except for the rich_text_areas, which both disappear. Removing the code required to make this a layout returns it back to normal. My code is below. I'm rendering a form as a partial with the following

Leaflet with Webpack in Rails 6. L.timeline is not a function

只愿长相守 提交于 2020-01-16 08:43:08
问题 This looks just like the question @rossta answered for Gmaps, but I don't understand the problem and answer well enough to make his suggestion work. The error is: Uncaught TypeError: L.timeline is not a function at Object.success (mapTwo.js:14) Line 14 is var timelineData = L.timeline(data_data, { . Complete code below. I removed the leaflet gems that work in Rails 5.2 and in console yarn add leaflet yarn add leaflet.timeline and code: // app/javascript/packs/application.js import "core-js

Rails 6: How to add jquery-ui through webpacker?

我的梦境 提交于 2020-01-11 09:23:07
问题 I'm currently trying to implement a datepicker into my application, the problem is that there is no documentation on how to add the jquery-ui-rails gem through webpacker. Probably there is another way to add gems or another gem that would fit my needs? 回答1: You no longer need to add javascript libraries as gems (which are managed by the bundler). Instead, you add them with yarn and they are managed by webpack (which is enabled by adding the webpacker gem to the Gemfile). The following steps

$ is not defined when installing jQuery in Rails via Webpack

自古美人都是妖i 提交于 2020-01-04 14:32:56
问题 I'm trying to install jQuery in Rails 6.0.0.rc1 via Webpack and I'm not sure what I'm missing but I'm getting the error $ is not defined in the browser console despite being able to compile jQuery. I've added jQuery with yarn add jquery , so my package.json looks like this { "name": "muladeseis_app", "private": true, "dependencies": { "@babel/preset-react": "^7.0.0", "@rails/actioncable": "^6.0.0-alpha", "@rails/activestorage": "^6.0.0-alpha", "@rails/ujs": "^6.0.0-alpha", "@rails/webpacker":

NameError: undefined local variable or method `clock_entry_params’ for #<ClockEntriesController:0x00007f9e4347c208>

青春壹個敷衍的年華 提交于 2019-12-25 00:48:05
问题 Am playing around with Rails 6 and I have a problem with my strong params. I scaffolded Rails CRUD called ClockEntry with rails g scaffold ClockEntry user:references purpose:string time_in:datetime time_out:datetime and when I hit Create Button I get NameError: undefined local variable or method `clock_entry_params’ for #<ClockEntriesController:0x00007f9e4347c208> Here is the migration generated below: class CreateClockEntries < ActiveRecord::Migration[6.0] def change create_table :clock

Bootstrap JS functions not loading in Rails 6/Webpacker

ぐ巨炮叔叔 提交于 2019-12-25 00:28:14
问题 Climbing the learning curve with Webpacker and Rails 6. I've installed Boostrap 4 using Yarn and Webpacker. When I try play with Bootstrap components in a browser's JS console then I get: TypeError: $.fn.button is undefined . If I remove the Yarn installation add a Bootstrap CDN link in the head of the HTML (the old way) everything works fine. When I remove the CDN links and revert to using Webpacker I get back to the error above. Here is my Webpacker setup: // package.json { "name": "depot",

How to add multiple nested attributes to a multi file upload

寵の児 提交于 2019-12-24 18:43:53
问题 I am trying to set up a multi image upload with carrierwave. I am following the question Rails 4 multiple image or file upload using carrierwave and in particular the answer by @prograils https://stackoverflow.com/a/38769726/4779531. I have an album.rb model and a diapo.rb model. class Album < ApplicationRecord has_many :diapos accepts_nested_attributes_for :diapos, allow_destroy: true end + class Diapo < ApplicationRecord belongs_to :album has_and_belongs_to_many :authors, :join_table =>