Hi Dennis
Yes, you are right about rails 6, that's why I haven't released 3.6.0 yet. I
started to work on supporting webpack, but finally I decided I will postpone
webpack support to later version. But generator needs to work with 3.6.0,
setting up javascript pipeline, then I will release 3.6.0.
About this issue, I have done that, but I think you may forget some steps,
maybe you did them but you didn't put them in the email:
Add this to layouts/application.html.erb:
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
Add application.js to precompile in config/initializers/assets.rb:
Rails.application.config.assets.precompile += %w( application.js )
Without those steps, links are not working, although I can see 2 search action
links if I add these lines to controller:
conf.actions << :field_search
conf.field_search.link.parameters = {:kind => :field_search}
Once I add javascript_include_tag and application.js to assets precompile, I
can get action links working, including both search action links.
It may be useful to change label for one search action link, for example:
conf.field_search.link.label = 'Field Search'
Also, I don't know what gem is "jquery", but you don't need it, jquery-rails
gem has jquery.js and jquery_ujs.js, although I think it should work with
jquery-rails gem and rails-ujs.js instead of jquery_ujs.js
And I think it could work if you add only jquery and active_scaffold to app/
assets/javascripts/application.js, and leave javascript_pack_tag in your
layout, which should already include rails-ujs and turbolinks.
Regards
El martes, 23 de febrero de 2021 5:55:27 (CET) Dennis Bulgatz escribió:
> Hi Sergio,
>
> Thanks, but this is not working for me. I can get only field_search or
> search to work, but not both, using separate links, or the swap. I decided
> I would try to build a fresh application, so there would be no ambiguity
> about the test case, and thought it would also be good to document this
> somewhere. I was able to get the application to build, but not function
> properly. I think you need to update the bundle exec *rails g
> active_scaffold:install to work with latest rails stack, which has
> rearranged the asset folder. *Here are the steps I followed to build the
> test application on my mac.
>
> *Rails6 ActiveScaffoldProjectSetup*
>
> *git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch
> --unshallow*
> *brew update*
> *brew install node*
> *brew install yarn*
>
> *brew install rbenv*
> *rbenv install 2.7.1*
> *gem install bundler*
> * Successfully installed bundler-2.2.11*
> *gem install rails -v 6.0.3.5*
>
>
> *# Installing mysql2 gem with macOS Mojave and Brew*
> *gem install mysql2 -v '0.5.3' -- \*
> *--with-mysql-config /usr/local/Cellar/mysql@5.7/5.7.29/bin/mysql_config \*
> *--with-cppflags=-I/usr/local/opt/openssl@1.1/include \*
> *--with-ldflags=-L/usr/local/opt/openssl@1.1/lib*
>
>
> * mkdir rails6app*
> * cd rails6app/*
>
> *#bundler using old version*
> *gem update --system*
>
> *#create the new Rails app*
> *rails _6.0.3.5_ new myapp -d mysql*
>
> *cd myapp*
>
> *#Add to Gemfile*
> *gem 'active_scaffold', '3.6.0.rc2'*
> *gem 'jquery-rails'*
> *gem 'jquery' #Used by active_scaffold*
>
> *#run Bundle install*
> *bundle install*
>
> *#create app/assets/javascripts/application.js, and add these lines*
> *#The new architecture has moved the javascript folder and renamed it!*
> *//= require jquery*
> *//= require jquery_ujs*
> *//= require_tree .*
> *//= require active_scaffold*
>
>
> *#Setup your rails app for Active Scaffold*
> *bundle exec rails g active_scaffold:install *
>
> *#Create the database*
> *bundle exec rails db:create*
>
> *#Create a resource*
> *rails g active_scaffold:resource vehicle m_id:integer chassis:string
> type:string yr_made:string yr_ended:string doors:string drive_train:string
> e_mnt:string hp:integer trq:integer e_id:integer trans:string*
>
> *#Run the migration created to build the new resource*
> *bundle exec rails db:migrate*
>
> *#start the app*
> *bundle exec rails s*
>
> *#navigate to Resource*
> *
http://localhost:3000/vehicles*