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/[email protected]/5.7.29/bin/mysql_config \*
> *--with-cppflags=-I/usr/local/opt/[email protected]/include \*
> *--with-ldflags=-L/usr/local/opt/[email protected]/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*
>
> On Monday, February 22, 2021 at 4:34:27 AM UTC-6 [email protected] wrote:
> > Hi
> >
> > This is how I did in the past, it's in a project I haven't upgraded to
> >
> > master yet, but I think it should still work:
> > config.actions << :field_search
> >
> >
> > config.field_search.link.parameters = {:kind => :field_search}
> >
> > Regards
> >
> > El domingo, 21 de febrero de 2021 6:14:53 (CET) Dennis Bulgatz escribió:
> > > Can you confirm that search/field_search swap is working in current
> >
> > master,
> >
> > > or 3.6.0 rc2 ? I can only get search or field search to work, not both,
> > >
> > > and no "swap" behavior.
> > >
> > >
> > >
> > > If you have a working controller example, could you post it?
> > >
> > >
> > >
> > > Thanks!
> > >
> > >
> > >
> > > On Thursday, December 10, 2020 at 10:37:41 AM UTC-6 [email protected]
> >
> > wrote:
> > > > Hi
> > > >
> > > >
> > > >
> > > > This works like a charm, thanky you very much.
> > > >
> > > >
> > > >
> > > > Regards, Jan
> > > >
> > > >
> > > >
> > > > [email protected] schrieb am Freitag, 4. Dezember 2020 um 11:28:28
> >
> > UTC+1:
> > > >> El jueves, 3 de diciembre de 2020 15:48:53 (CET) [email protected]
> > > >>
> > > >> escribió:
> > > >> > Hi
> > > >> >
> > > >> >
> > > >> >
> > > >> > Is it possible to add an action/button/whatever to let my users
> >
> > toggle
> >
> > > >> > between seach and field search in an List?
> > > >> >
> > > >> >
> > > >> >
> > > >> > Regards, Jan
> > > >>
> > > >> Hi
> > > >>
> > > >>
> > > >>
> > > >> By default, you must choose if you want to use search or field search
> > > >>
> > > >> actions,
> > > >>
> > > >> swapping search with field_search action (config.actions.swap
> > > >> :search,
> > > >>
> > > >> :field_search), or leaving default search action.
> > > >>
> > > >> If you add field_search action, instead of swapping search, it will
> >
> > add
> >
> > > >> action_link to show search with same parameters as search's action
> >
> > link,
> >
> > > >> which
> > > >>
> > > >> will open form for search action. You can define kind parameter of
> > > >> the
> > > >>
> > > >> field_search's action_link:
> > > >>
> > > >>
> > > >>
> > > >> config.field_search.link.parameters = {:kind => :field_search}
> > > >>
> > > >>
> > > >>
> > > >> In this way, you will get 2 show search links, so you may want to
> >
> > change
> >
> > > >> some
> > > >>
> > > >> labels too.
> > > >>
> > > >>
> > > >>
> > > >> Regards
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/activescaffold/12149161.F8jnoBqmlB%40pc-sergio.