Git Product home page Git Product logo

forestadmin / forest-rails Goto Github PK

View Code? Open in Web Editor NEW
360.0 17.0 76.0 2.39 MB

💎 Ruby on Rails agent for Forest Admin to integrate directly to your existing Ruby on Rails backend application.

Home Page: https://www.forestadmin.com

License: GNU General Public License v3.0

Ruby 97.58% JavaScript 0.86% CSS 0.55% HTML 1.00% Shell 0.02%
admin rails gem admin-panel internal-tool ruby ruby-on-rails backend backend-api

forest-rails's Introduction

Forest Admin in Rails

Gem CI status Test Coverage semantic-release

Forest Admin provides an off-the-shelf administration panel based on a highly-extensible API plugged into your application.

This project has been designed with scalability in mind to fit requirements from small projects to mature companies.

Who Uses Forest Admin

Getting Started

https://docs.forestadmin.com/documentation/how-tos/setup/install

Documentation

https://docs.forestadmin.com/documentation/

How it works

Howitworks

Forest Admin consists of two components:

  • The Admin Frontend is the user interface where you'll manage your data and configuration.
  • The Admin Backend API hosted on your servers where you can find and extend your data models and all the business logic (routes, actions, …) related to your admin panel.

The Forest Admin gem (aka Forest Liana) introspects all your data model and dynamically generates the Admin API hosted on your servers. The Forest Admin interface is a web application that handles communication between the admin user and your application data through the Admin API.

Features

CRUD

All of your CRUD operations are natively supported. The API automatically supports your data models' validation and allows you to easily extend or override any API routes' with your very own custom logic.

CRUD

Search & Filters

Forest Admin has a built-in search allowing you to run basic queries to retrieve your application's data. Set advanced filters based on fields and relationships to handle complex search use cases.

Search and Filters

Sorting & Pagination

Sorting and pagination features are natively handled by the Admin API. We're continuously optimizing how queries are run in order to display results faster and reduce the load of your servers.

Sorting and Pagination

Custom action

A custom action is a button which allows you to trigger an API call to execute a custom logic. With virtually no limitations, you can extend the way you manipulate data and trigger actions (e.g. refund a customer, apply a coupon, ban a user, etc.)

Custom action

Export

Sometimes you need to export your data to a good old fashioned CSV. Yes, we know this can come in handy sometimes :-)

Export

Segments

Get in app access to a subset of your application data by doing a basic search or typing an SQL query or implementing an API route.

Segments

Dashboards

Forest Admin is able to tap into your actual data to chart out your metrics using a simple UI panel, a SQL query or a custom API call.

Dashboard

WYSIWYG

The WYSIWYG interface saves you a tremendous amount of frontend development time using drag'n'drop as well as advanced widgets to build customizable views.

WYSIWYG

Custom HTML/JS/CSS

Code your own views using JS, HTML, and CSS to display your application data in a more appropriate way (e.g. Kanban, Map, Calendar, Gallery, etc.).

Custom views

Team-based permissions

Without any lines of code, manage directly from the UI who has access or can act on which data using a team-based permission system.

Team based permissions

Third-party integrations

Leverage data from third-party services by reconciling it with your application’s data and providing it directly to your Admin Panel. All your actions can be performed at the same place, bringing additional intelligence to your Admin Panel and ensuring consistency.

Third-party integrations

Notes & Comments

Assign your teammates to specific tasks, leave a note or simply comment a record, thereby simplifying collaboration all across your organization.

Notes and Comments

Activity logs

Monitor each action executed and follow the trail of modification on any data with an extensive activity log system.

Activity logs

How to contribute

This repository is officially maintained by Forest Admin. We're always happy to get contributions for other fellow lumberjacks. All contributions will be reviewed by Forest Admin's team before being merged into main.

Here is the contribution workflow:

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull request so that we can review your changes

Please ensure that the tests are passing before submitting any pull request:

$ RAILS_ENV=test bundle exec rake --trace db:migrate test

Community

👇 Join our Developers community for support and more

Discourse developers community

forest-rails's People

Contributors

arnaud-moncel avatar arnaudbesnier avatar arnaudvalensi avatar dependabot[bot] avatar drraider avatar forest-bot avatar fradim avatar gabklein avatar ghusse avatar guillaumecisco avatar jeffladiray avatar larcin avatar lostie avatar lucasscariot avatar marcperrinp avatar matthv avatar nicolasalexandre9 avatar olesyakorovina avatar rap2hpoutre avatar romain-gilliotte avatar romaincoudour avatar root-io avatar seyz avatar slimee avatar stevebunlon avatar thenkei avatar timastier avatar uelb avatar vincentmolinie avatar ziadgh1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

forest-rails's Issues

Support for Error Logging instrumentation

Hi guys,

Whenever there is an issue/error in the Forest code, the error is rescued and a 404 is returned. This is an unpleasant behavior because the actual errors are not rescued by the error logging software. We use AppSignal

All production applications are using some sort of error logging tools, so it would be great to not swallow errors but properly log them in order to monitor the Forest performance.

Let me know what are your thoughts about it.

Karens

Smart action response rails 5

The code for smart actions in the doc has deprecated code for rails 5

# ForestLiana::ApplicationController takes care of the authentication for you.
class Forest::CustomersController < ForestLiana::ApplicationController
  def ban_user
    # Your business logic to send an email here.
    render nothing: true, status: 204
  end
end

As this post suggests, it should be

# ForestLiana::ApplicationController takes care of the authentication for you.
class Forest::CustomersController < ForestLiana::ApplicationController
  def ban_user
    # Your business logic to send an email here.
    head :ok
  end
end

Can't have custom class names for associations

For example, I have a table called transactions. I had to make a custom association name because .transaction is reserved:

  belongs_to :a_transaction, :class_name => "Transaction"

This causes a bug though when trying to load the data:

ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR:  column communications.a_transaction_id does not exist

Is it possible to support custom association names?

[QUESTION] Multiple images uploading

Hello,

Thanks for your amazing product!
I have a question though. We are using carrierwave to upload multiple images on our Product model (using a string field :images as an array). However, I can't manage to do multiple images upload directly in Forest: my field as array doesn't allow me to generate multiple filepickers (I just have a text field). It is only working for single image.

I also tried using attachinary gem, but it was even worth. Do you have any idea how to manage this (displaying multiple filepickers)? Or should I go for an Image model handled by carrierwave and belonging to Product?

Thank you for your support!

Smart Action - Call action from a "smart action" example

While using smart actions (again) I'm trying to do something that seems could be integrated to forest and maybe even useful for other users as well.

I'm trying to do 2 different things. The second is workaround for the first one.

1. Update an object through a button from a Smart Action result.

Update an object through a button click from a smart action result view.

Practical example:

I've a Venue model with a google_api_place_id property. The way I get this dada is by calling Google Search Api with something like My venue name in Helsinki. I will then receive 0 or n results. Currently I'm displaying them in the smart action result view but the volume is consequent and I need to be able to have a button doing something like <%= forest_update_object "Save this place_id", object: my_object, data: { google_api_place_id: some_value } %>

2. Call a smart action from a smart action

While trying to come with a workaround for (1) I thought about this solution. Maybe it's already there or possible by using the right helpers.

The goal here is to be able from smart action result view to call another smart action with parameters.

<%= forest_smart_action_button 'name of smart action', ids: array_of_object_ids, fields: array_of_fields %>

NB: In my opinion the fields should be different for each id. But as Forest works already like that, I think we should keep this "incoherence" in my opinion

It is important in this scenario to keep the view open and do not replace the result with the result of the called action. We could have multiple actions to call from one view.

Let me know your thoughts on this matter.

[*] Details View - Details view is blank

Expected behavior

See details of the object

Actual behavior

Object details are blank.

Failure Logs

screen shot 2018-01-08 at 14 53 51

Context

  • Package Version: forest_liana (2.0.4)
  • Rails Version: rails (4.2.10)
  • Database Version: PG Version 9.6.6

serialized_attributes is deprecated in Rails 5.0

La gem forest-liana provoque un grand nombre d'alertes (avec Rails 4.2.7 en tout cas) :
DEPRECATION WARNING: serialized_attributes is deprecated without replacement, and will be removed in Rails 5.0.

par exemple lors du lancement d'une console rails console

Smart Action, unpredicted behaviour (?) field value

I don't know if this is normal behaviour, but if it is, maybe you should specify it on the doc. When you have a in your smart action and you submit the fields to the action, somethimes the field is blank, sometimes it submits no field.

Expected behaviour

Field value to be always blank or always not present. But not both.

## Actual behavior

not present case:

  1. Click on a smart action with fields button
  2. Opens the fields view
  3. Click on submit button

This gives us
fields: { }

blank case:

  1. Click on a smart action with fields button
  2. Opens the fields part
  3. Click on the field
  4. Click outside the field
  5. Click on submit button

This gives us
fields: { "name of field": "" }

Failure Logs

none

Context

not relevant, or if so, ask and I will provide.

Rails 5.0.0/Ruby 2.3.1 can't modify frozen Array (RuntimeError)

I've ran into this issue only when running the app in production, not in development.

My Gemfile:

source 'https://rubygems.org'

ruby '2.3.1'

gem 'rails', '~> 5.0.0'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'devise_token_auth', github:"lynndylanhurley/devise_token_auth", branch: "master"
gem 'rack-cors', require: 'rack/cors'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-google-oauth2'
gem 'figaro'
gem 'jbuilder'
gem 'pry-rails'
gem 'validates_timeliness'
gem 'paperclip'
gem 'aws-sdk', '>= 2.0.34'
gem 'geocoder'
gem 'ransack'
gem 'apipie-rails'
gem 'forest_liana'

group :development, :test do
  gem 'byebug', platform: :mri
end

group :development do
  gem 'listen', '~> 3.0.5'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

My stacktrace:

=> Booting Puma
=> Rails 5.0.0 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Exiting
/Users/alfredo/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/stack.rb:74:in `insert': can't modify frozen Array (RuntimeError)
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/stack.rb:74:in `insert'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/forest_liana-1.3.50/lib/forest_liana/engine.rb:22:in `configure_forest_cors'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/railtie.rb:193:in `public_send'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/railtie.rb:193:in `method_missing'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/forest_liana-1.3.50/lib/forest_liana/engine.rb:36:in `block in <class:Engine>'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/application/finisher.rb:65:in `block in <module:Finisher>'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/initializable.rb:30:in `instance_exec'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/initializable.rb:30:in `run'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
	from /Users/alfredo/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
	from /Users/alfredo/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /Users/alfredo/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /Users/alfredo/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /Users/alfredo/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
	from /Users/alfredo/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
	from /Users/alfredo/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
	from /Users/alfredo/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
	from /Users/alfredo/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/initializable.rb:54:in `run_initializers'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/application.rb:352:in `initialize!'
	from /Users/alfredo/Documents/workspace/zulu-rails/config/environment.rb:5:in `<top (required)>'
	from /Users/alfredo/Documents/workspace/zulu-rails/config.ru:3:in `require_relative'
	from /Users/alfredo/Documents/workspace/zulu-rails/config.ru:3:in `block in <main>'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
	from /Users/alfredo/Documents/workspace/zulu-rails/config.ru:in `new'
	from /Users/alfredo/Documents/workspace/zulu-rails/config.ru:in `<main>'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/server.rb:59:in `app'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:282:in `start'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/server.rb:79:in `start'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:90:in `block in server'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
	from /Users/alfredo/Documents/workspace/zulu-rails/bin/rails:9:in `require'
	from /Users/alfredo/Documents/workspace/zulu-rails/bin/rails:9:in `<top (required)>'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
	from /Users/alfredo/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
	from /Users/alfredo/Documents/workspace/zulu-rails/bin/spring:13:in `require'
	from /Users/alfredo/Documents/workspace/zulu-rails/bin/spring:13:in `<top (required)>'
	from bin/rails:3:in `load'
	from bin/rails:3:in `<main>'

The part of the program which does something naughty is line 21 of the engine:

      config.middleware.insert_before 0, rack_cors_class do
        allow do
          hostnames = ['localhost:4200', 'app.forestadmin.com',
                       'www.forestadmin.com']
          hostnames += ENV['CORS_ORIGINS'].split(',') if ENV['CORS_ORIGINS']

          origins hostnames
          resource '*', headers: :any, methods: :any
        end

I've set my CORS_ORIGINS env var: export CORS_ORIGINS=zulu-rails.herokuapp.com (name of my app on heroku. I've set it up that way on my machine and my heroku dyno and I still run into the same issue on both.

I've managed to successfully work around the issue by removing the cors configuration call from the engine and doing cors initialization instead from an initialier under /config/initializers/cors.rb, but of course I understand this is not sensible.

I actually have the time to look into this and contribute if you guys don't mind, but it's 2 AM over here and I gotta rest a bit xD. Will check in back again in the morning.

Issues caused by User class not having id as the primary key

The User class on one of our apps uses a primary key called 'uuid' instead of 'id'. I assume that Forest expects an 'id' column by default because the default Dashboard tab throws this exception every time the Dashboard is accessed:
PG::UndefinedColumn: ERROR: column "id" does not exist LINE 1: SELECT DISTINCT COUNT(DISTINCT id) FROM "users" LEFT OUTER J... ^ : SELECT DISTINCT COUNT(DISTINCT id) FROM "users" LEFT OUTER JOIN "users" "primary_accounts_users" ON "primary_accounts_users"."uuid" = "users"."primary_account_id"

This is also preventing us from deleting users. Is there a way to change the default primary key name that forest expects?

certificate verify failed (OpenSSL::SSL::SSLError)

i got this error when do rails s

/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=error: certificate verify failed (OpenSSL::SSL::SSLError)

installation was smooth
how to fix this?

Custom Integrations / Auth / CSS or Design

How would I go about creating a custom integration?

How would I go about securing my admin interface with my legacy authentication store or oauth provider?

How would I customize the design (CSS/SCSS)?

Thanks

Forest prevents app/console from starting when disconnected from internet

I was disconnected from internet, I just tried to launch rails console and 💥 :

/usr/local/lib/ruby/2.4.0/net/http.rb:906:in `rescue in block in connect': Failed to open TCP connection to forestadmin-server.herokuapp.com:443 (getaddrinfo: Name or service not known) (SocketError)
	from /usr/local/lib/ruby/2.4.0/net/http.rb:903:in `block in connect'
	from /usr/local/lib/ruby/2.4.0/timeout.rb:93:in `block in timeout'
	from /usr/local/lib/ruby/2.4.0/timeout.rb:103:in `timeout'
	from /usr/local/lib/ruby/2.4.0/net/http.rb:902:in `connect'
	from /usr/local/lib/ruby/2.4.0/net/http.rb:887:in `do_start'
	from /usr/local/lib/ruby/2.4.0/net/http.rb:876:in `start'
	from /usr/local/bundle/gems/forest_liana-1.5.23/lib/forest_liana/bootstraper.rb:146:in `send_apimap'
	from /usr/local/bundle/gems/forest_liana-1.5.23/lib/forest_liana/bootstraper.rb:28:in `perform'
	from /usr/local/bundle/gems/forest_liana-1.5.23/lib/forest_liana/engine.rb:51:in `block in <class:Engine>'
	from /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
	from /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
	from /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/lazy_load_hooks.rb:51:in `each'
	from /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
	from /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/application/finisher.rb:73:in `block in <module:Finisher>'
	from /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/initializable.rb:30:in `instance_exec'
	from /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/initializable.rb:30:in `run'
	from /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/initializable.rb:59:in `block in run_initializers'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `call'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
	from /usr/local/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
	from /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/initializable.rb:58:in `run_initializers'
	from /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/application.rb:353:in `initialize!'
	from /app/config/environment.rb:5:in `<top (required)>'
	from /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/dependencies.rb:292:in `require'
	from /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/dependencies.rb:292:in `block in require'
	from /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/dependencies.rb:258:in `load_dependency'
	from /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/dependencies.rb:292:in `require'
	from /usr/local/bundle/gems/spring-2.0.1/lib/spring/application.rb:92:in `preload'
	from /usr/local/bundle/gems/spring-2.0.1/lib/spring/application.rb:143:in `serve'
	from /usr/local/bundle/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run'
	from /usr/local/bundle/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop'
	from /usr/local/bundle/gems/spring-2.0.1/lib/spring/application.rb:125:in `run'
	from /usr/local/bundle/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>'
	from /usr/local/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from -e:1:in `<main>'

I understand I can't use Forest offline, but my app is not only about 🌳🌳🌳 . Sometimes I want to work on a 🚄 , at 🏠 without being connected, or just... one day... Forest servers could be down. The gem should gracefully handle this (rare) case.

Pagination and search for SmartCollections

Hi there, thanks for this great app!

I just setup a few SmartCollections and I am aiming to have them function similar to the 'default' collections.

Is there any documentation for paginating these SmartCollections and making them searchable?

Thanks!

Smart fields, has_many relation trying a reverse belongs_to

I'm trying to create a Smart Field in order to count the relations from a model. I basically have this associations:

Models

Venue

class Venue < ApplicationRecord
  belongs_to :region, optional: true
  has_many :food_types
end

Region

class Region < ApplicationRecord
  has_many :venues
end

FoodType

class FoodType < ApplicationRecord
  has_many :venues
end

Associations

#### Region

class Forest::Region
  include ForestLiana::Collection
  collection :regions
  field :number_of_venues, type: 'Number' do
    object.venues.count
  end
end

#### FoodType

class Forest::FoodType
  include ForestLiana::Collection
  collection :food_types
  field :number_of_venues, type: 'Number' do
    object.venues.count
  end
end

Error

Completed 500 Internal Server Error in 66ms (ActiveRecord: 13.0ms)
ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR:  column venues.food_type_id does not exist
LINE 1: SELECT COUNT(*) FROM "venues" WHERE "venues"."food_type_id" ...
                                            ^
: SELECT COUNT(*) FROM "venues" WHERE "venues"."food_type_id" = $1):
  
lib/forest_liana/collections/food_type.rb:7:in `block in <class:FoodType>'

I can't figure out how to make it work and it seems forest is thinking I'm using a belongs_to in the "other side" of the relation.

Pie Charts - Issue when creating a chart from a belongs_to relationship

I have two classes

class Casino < ApplicationRecord has_many :coupons end
and
class Coupon < ApplicationRecord belongs_to :casino end

when i try to create a chart in forest grouping coupons by any of the casino's properties, i get an exclamation point and "Forest cannot render this chart".

when i look at my console, i see the following error:
NoMethodError - undefined method split' for nil:NilClass:
forest_liana (1.5.11) app/services/forest_liana/operator_value_parser.rb:58:in get_field_name' forest_liana (1.5.11) app/services/forest_liana/operator_value_parser.rb:35:in get_condition'
forest_liana (1.5.11) app/services/forest_liana/value_stat_getter.rb:17:in block in perform' activesupport (5.0.1) lib/active_support/core_ext/object/try.rb:17:in each'
activesupport (5.0.1) lib/active_support/core_ext/object/try.rb:17:in public_send' activesupport (5.0.1) lib/active_support/core_ext/object/try.rb:17:in try!'
activesupport (5.0.1) lib/active_support/core_ext/object/try.rb:6:in try' forest_liana (1.5.11) app/services/forest_liana/value_stat_getter.rb:15:in perform'
forest_liana (1.5.11) app/controllers/forest_liana/stats_controller.rb:19:in show'

any idea what it could be?

[DEPRECATION] uniq deprecated

I'm getting this deprecation warning from the stats controller, can this be looked into?

DEPRECATION WARNING: uniq is deprecated and will be removed from Rails 5.1 (use distinct instead) (called from count at [ruby_path]/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/forest_liana-1.6.13/app/services/forest_liana/value_stat_getter.rb:59)

Crash on boot

If I change ActiveRecord::Base.connection.instance_values["config"][:adapter] to ActiveRecord::Base.connection.config[:adapter] it works

/home/braulio/.rvm/gems/ruby-2.4.2/gems/forest_liana-2.0.3/lib/forest_liana/bootstraper.rb:174:in `send_apimap': undefined method `[]' for nil:NilClass (NoMethodError)
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/forest_liana-2.0.3/lib/forest_liana/bootstraper.rb:29:in `perform'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/forest_liana-2.0.3/lib/forest_liana/engine.rb:51:in `block in <class:Engine>'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/activesupport-4.2.9/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/activesupport-4.2.9/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/activesupport-4.2.9/lib/active_support/lazy_load_hooks.rb:44:in `each'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/activesupport-4.2.9/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/initializable.rb:30:in `run'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
        from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:347:in `each'
        from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:347:in `call'
        from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
        from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
        from /home/braulio/.rvm/rubies/ruby-2.4.2/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/initializable.rb:54:in `run_initializers'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/application.rb:352:in `initialize!'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/railtie.rb:194:in `public_send'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/railtie.rb:194:in `method_missing'
        from /home/braulio/Projects/olery/oat/spec/dummy/config/environment.rb:5:in `<top (required)>'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `require'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `block in require'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:274:in `require'
        from /home/braulio/Projects/olery/oat/spec/dummy/config.ru:3:in `block in <main>'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rack-1.6.8/lib/rack/builder.rb:55:in `instance_eval'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rack-1.6.8/lib/rack/builder.rb:55:in `initialize'
        from /home/braulio/Projects/olery/oat/spec/dummy/config.ru:in `new'
        from /home/braulio/Projects/olery/oat/spec/dummy/config.ru:in `<main>'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rack-1.6.8/lib/rack/builder.rb:49:in `eval'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rack-1.6.8/lib/rack/builder.rb:49:in `new_from_string'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rack-1.6.8/lib/rack/builder.rb:40:in `parse_file'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rack-1.6.8/lib/rack/server.rb:300:in `build_app_and_options_from_config'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rack-1.6.8/lib/rack/server.rb:209:in `app'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/commands/server.rb:61:in `app'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/rack-1.6.8/lib/rack/server.rb:337:in `wrapped_app'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/commands/server.rb:139:in `log_to_stdout'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/commands/server.rb:78:in `start'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:80:in `block in server'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:75:in `server'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /home/braulio/.rvm/gems/ruby-2.4.2/gems/railties-4.2.9/lib/rails/commands.rb:17:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

Renaming a Model

I wasn't that smart when I created a model Api and I'm seeing problems coming because of that. For that reason, I renamed it by creating a migration and renaming the model / controller / route manually (declaration + file name).

But somehow the dashboard wasn't able to follow as you can see here:

screen shot 2017-12-27 at 8 41 52 pm

It was stupid to do and I realised it too late.

Is there any way I could simply trigger the "renaming" in the dashboard? I would like to keep the same segments / field display, etc...

[+] Paranoia Gem - Support it in a "Recovery" mode in Forest.

Hi guys,

I have feature request for support of the paranoia gem. All Rails community uses it in order to soft delete the records. However, the support with Forest is very unpredictable: sometimes the records are found and sometimes not (e.g. lists, details, associations).

It would be great to

  1. always show the deleted records
  2. have a red bar/cross or something similar to indicate that the record is deleted.

Let me know what are your thoughts about this problem.

Karens

UX tiny detail slowing down configuration

Hi,

I'm using your product for a new project and going through the configuration of 4 models, I've something that really bugs me just a tiny bit but is making me insane.

When you have a fresh model to configure the fields, every time you save you get that message:
screen shot 2017-08-03 at 2 49 06 pm

No big deal with the message, but the placement is a pain as it is on top of the save button. It stays longer than the time it takes me to do:

  • click field
  • pick type
  • save
  • click next field
  • pick type

If it was moved a bit higher than there (just on top of the save button for example) it will be wonderful.

I know it's tiny and not that big of a deal, but is still irritating. Thought you might know that.


BTW: I just saw you moved the "text field" option above the "text area" option: good move guys


In a mother note, I love your product. It's 5 years I deal with startups with products changing web habits and reinvent ways of doing stuff. And I have to say that Forest is the tool that is needed.

Mark my words, in 5 years you gonna be acquired by one of the big tech names. mark my words...

STI models, segment giving wrong dataset

Hi,

It's me, again.

I encounter a problem with the Segments and the STI.

My models:

class Venue < ApplicationRecord
  has_one google_api
  has_one wolt_api
end

class Api < ApplicationRecord
   belongs_to :venue
end

class WoltApi < Api
end

class GoogleApi < Api
end

WoltApiand GoogleApiare STI, therefore, they both have a field api_venue_id

NB: api_venue_idis NOT a attribute reference id. This is simply the name of the field, you can use api_potatoes it will be the same.

I've two segments in my Venue table:

  1. wolt_api -> api_venue_id -> $blank
  2. google_api -> api_venue_id -> $blank

It is necessary to know I've the field api_venue_id as the "value displayed when we reference the model".

When I display wolt_api and google_api in my datatable, both segments have the same amount of rows. When I don't have it, it works.

Sadly, I need to have this data on the datatable.

This is the query I can see in the log:

SELECT  "venues"."id" AS t0_r0, "venues"."status" AS t0_r1, "venues"."name" AS t0_r2, "venues"."email" AS t0_r3, "venues"."phone" AS t0_r4, "venues"."route" AS t0_r5, "venues"."locality" AS t0_r6, "venues"."postal_code" AS t0_r7, "venues"."note" AS t0_r8, "venues"."facebook" AS t0_r9, "venues"."twitter" AS t0_r10, "venues"."instagram" AS t0_r11, "venues"."region_id" AS t0_r12, "venues"."group_id" AS t0_r13, "venues"."created_at" AS t0_r14, "venues"."updated_at" AS t0_r15, "venues"."slug" AS t0_r16, "venues"."street_number" AS t0_r17, "venues"."floor" AS t0_r18, "venues"."country" AS t0_r19, "apis"."id" AS t1_r0, "apis"."type" AS t1_r1, "apis"."api_status" AS t1_r2, "apis"."api_called_at" AS t1_r3, "apis"."api_payload" AS t1_r4, "apis"."api_venue_id" AS t1_r5, "apis"."venue_url" AS t1_r6, "apis"."name" AS t1_r7, "apis"."price_level" AS t1_r8, "apis"."rating" AS t1_r9, "apis"."reviews_count" AS t1_r10, "apis"."address" AS t1_r11, "apis"."street_number" AS t1_r12, "apis"."route" AS t1_r13, "apis"."floor" AS t1_r14, "apis"."locality" AS t1_r15, "apis"."postal_code" AS t1_r16, "apis"."country" AS t1_r17, "apis"."latitude" AS t1_r18, "apis"."longitude" AS t1_r19, "apis"."phone" AS t1_r20, "apis"."website" AS t1_r21, "apis"."permanently_closed" AS t1_r22, "apis"."show_phone_number_on_merchant" AS t1_r23, "apis"."customer_support_phone" AS t1_r24, "apis"."delivery" AS t1_r25, "apis"."public_visible" AS t1_r26, "apis"."michelin_stars" AS t1_r27, "apis"."venue_id" AS t1_r28, "apis"."created_at" AS t1_r29, "apis"."updated_at" AS t1_r30, "wolt_apis_venues"."id" AS t2_r0, "wolt_apis_venues"."type" AS t2_r1, "wolt_apis_venues"."api_status" AS t2_r2, "wolt_apis_venues"."api_called_at" AS t2_r3, "wolt_apis_venues"."api_payload" AS t2_r4, "wolt_apis_venues"."api_venue_id" AS t2_r5, "wolt_apis_venues"."venue_url" AS t2_r6, "wolt_apis_venues"."name" AS t2_r7, "wolt_apis_venues"."price_level" AS t2_r8, "wolt_apis_venues"."rating" AS t2_r9, "wolt_apis_venues"."reviews_count" AS t2_r10, "wolt_apis_venues"."address" AS t2_r11, "wolt_apis_venues"."street_number" AS t2_r12, "wolt_apis_venues"."route" AS t2_r13, "wolt_apis_venues"."floor" AS t2_r14, "wolt_apis_venues"."locality" AS t2_r15, "wolt_apis_venues"."postal_code" AS t2_r16, "wolt_apis_venues"."country" AS t2_r17, "wolt_apis_venues"."latitude" AS t2_r18, "wolt_apis_venues"."longitude" AS t2_r19, "wolt_apis_venues"."phone" AS t2_r20, "wolt_apis_venues"."website" AS t2_r21, "wolt_apis_venues"."permanently_closed" AS t2_r22, "wolt_apis_venues"."show_phone_number_on_merchant" AS t2_r23, "wolt_apis_venues"."customer_support_phone" AS t2_r24, "wolt_apis_venues"."delivery" AS t2_r25, "wolt_apis_venues"."public_visible" AS t2_r26, "wolt_apis_venues"."michelin_stars" AS t2_r27, "wolt_apis_venues"."venue_id" AS t2_r28, "wolt_apis_venues"."created_at" AS t2_r29, "wolt_apis_venues"."updated_at" AS t2_r30 FROM "venues" LEFT OUTER JOIN "apis" ON "apis"."venue_id" = "venues"."id" AND "apis"."type" IN ('GoogleApi') LEFT OUTER JOIN "apis" "wolt_apis_venues" ON "wolt_apis_venues"."venue_id" = "venues"."id" AND "wolt_apis_venues"."type" IN ('WoltApi') WHERE (apis. wolt_apis_venues.api_venue_id IS NULL) ORDER BY venues.name DESC LIMIT $1 OFFSET $2  [["LIMIT", 20], ["OFFSET", 0]]

I believe it is the WHERE clause that fucks it up WHERE (apis.api_venue_id IS NULL). By using apis instead of "wolt_apis_venues" it takes in account the other LEFT OUTER JOIN. But I'm just guessing here...

Any idea how to fix this?

Activerecord uuid joins error

I'm having a weird PG error on a list view /:id/list/:id
I'm running on the master version of Forest, here the stack trace

ActiveRecord::StatementInvalid (PG::UndefinedFunction: ERROR:  operator does not exist: uuid = character varying
LINE 1: ..." IS NULL LEFT OUTER JOIN "teams" ON "teams"."id" = "members...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

activerecord (4.2.7.1) lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `async_exec'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `block in exec_no_cache'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
  activesupport (4.2.7.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `exec_no_cache'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/postgresql_adapter.rb:584:in `execute_and_clear'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `exec_query'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/database_statements.rb:356:in `select'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `block in select_all'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/query_cache.rb:83:in `cache_sql'
  activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `select_all'
  activerecord (4.2.7.1) lib/active_record/relation/finder_methods.rb:356:in `find_with_associations'
  activerecord (4.2.7.1) lib/active_record/relation.rb:639:in `exec_queries'
  activerecord (4.2.7.1) lib/active_record/relation.rb:515:in `load'
  activerecord (4.2.7.1) lib/active_record/relation.rb:243:in `to_a'
  .rvm/gems/ruby-2.3.1/bundler/gems/forest-rails-76abb4ec4053/app/services/forest_liana/resources_getter.rb:15:in `records'
  .rvm/gems/ruby-2.3.1/bundler/gems/forest-rails-76abb4ec4053/app/controllers/forest_liana/resources_controller.rb:14:in `index'

Forest can't render chart with smart field

Hello,

I have an issue rendering a very simple chart. I have an orders table with a amount_cents column (the total amount of the order in cents). I computed a full_amount smart fieldas following:

class Forest::Order
  include ForestLiana::Collection

  collection :orders

  field :full_amount, type: 'Number' do
    object.amount_cents.fdiv(100)
  end
end

It works well in my orders data in forest.
However, when I try to use this smart field to display data in a chart, it doesn't work: Forest cannot render this chart.

I can't see what I am doing wrong, any idea ?

Thanks a lot for your great job !

[1.6.17] Customization of attributes presence validation

On object creation, attributes having presence validation can't be submitted (marked as "can't be blank"). How can we customize this validation to disable it on specific attributes?

In my case, I have many default values defined in before_validation filters so I would like the form to actually accept blank values for certain attributes.

Thanks!

[+] Records Edition - Conditional editing forms

I would like to have conditional editing on the fields in the dashboard. I think this is something missing and I've multiple cases where it becomes difficult to use the dashboard in production because of that.

Let me explain with a concrete exemple.

I've a model Venue with the properties

  • name
  • address
  • google_api_place_id.

Field types

google_api_place_id is empty

field type
name text
address text
google_api_place_id read only

google_api_place_id is not empty

field type
name text
address read only
google_api_place_id read only

Questions while using in Rails API mode

Hi folks, thank you for providing this service! While integrating with the project (Rails in API mode), I get the following errors while starting the server:

→ rails s
=> Booting Puma
=> Rails 5.1.4 application starting in development
=> Run `rails server -h` for more startup options
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/reflection.rb:761:in `rescue in foreign_key'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/reflection.rb:761:in `foreign_key'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/app/serializers/forest_liana/serializer_factory.rb:332:in `map'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/app/serializers/forest_liana/serializer_factory.rb:332:in `foreign_keys'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/app/serializers/forest_liana/serializer_factory.rb:327:in `association?'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/app/serializers/forest_liana/serializer_factory.rb:293:in `block in attributes'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/app/serializers/forest_liana/serializer_factory.rb:292:in `select'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/app/serializers/forest_liana/serializer_factory.rb:292:in `attributes'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/app/serializers/forest_liana/serializer_factory.rb:162:in `serializer_for'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/lib/forest_liana/bootstraper.rb:65:in `block in create_factories'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/lib/forest_liana/bootstraper.rb:64:in `map'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/lib/forest_liana/bootstraper.rb:64:in `create_factories'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/lib/forest_liana/bootstraper.rb:24:in `perform'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/forest_liana-1.8.0/lib/forest_liana/engine.rb:51:in `block in <class:Engine>'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:67:in `block in execute_hook'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:73:in `block in <module:Finisher>'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/2.4.0/tsort.rb:347:in `each'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/2.4.0/tsort.rb:347:in `call'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
/Users/anuj/Github/sapi/config/environment.rb:5:in `<top (required)>'
config.ru:3:in `require_relative'
config.ru:3:in `block in <main>'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
/Users/anuj/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
config.ru:in `new'
config.ru:in `<main>'

Another question: How do I change the port which Forest uses? Currently it is using 3000 which I am using for non-admin APIs and I'd like Forest to be on a different port.

Thanks,
Anuj

Wrong pasting in secrets.yml

Hello, when running rails g forest_liana:install _my_key_ in Rails 5.1, I get this in my secrets.yml:

# Do not keep production secrets in the unencrypted secrets file.
# Instead, either read values from the environment.
# Or, use `bin/rails secrets:setup` to configure encrypted secrets
# and move the `production:
  forest_env_secret: <%= ENV["FOREST_ENV_SECRET"] %>
  forest_auth_secret: <%= ENV["FOREST_AUTH_SECRET"] %>` environment over there.

in the test section, which breaks the comment.

[QUESTION] Smart Collection specific style for Enum column + show redirection

Hello the Forest Team,

I created a smart collection 'STAGE' to view the stage of all my orders.

It's working and it's great but i have two issues to finalize it:

  1. I have two Enum type column and I would like the same style (it's the style of one of my table):

image

How ForestAdmin can detect an Enum column for a smart collection ?

2 - For the moment when i click on a line of my Smart Collection i have a message error "This Stage does not exist."
When i click on a line i would like to be redirect to the Request associate. I know how to find the ID of the Request in the params but i don't know how to passed it to Forest to open te 'show' of the request concerned.

Do you have a recommandation ?

I'm just starting to configure my ForestAdmin but it's look awesome,

forest_liana gem 2.0.0 update not working

Ran bundle update on an existing project, which updated forest_liana gem from 1.9.8 to 2.0.0, installed successfully. Tried to boot the app locally and failed with the following boot error:

C:/Ruby22/lib/ruby/gems/2.2.0/gems/forest_liana-2.0.0/app/serializers/forest_liana/serializer_factory.rb:15:in const_set': wrong constant name ActiveRecord::SessionStoreSessionSerializer (NameError)
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/forest_liana-2.0.0/app/serializers/forest_liana/serializer_factory.rb:15:in define_serializer' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/forest_liana-2.0.0/app/serializers/forest_liana/serializer_factory.rb:252:in serializer_for'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/forest_liana-2.0.0/lib/forest_liana/bootstraper.rb:75:in block in create_factories' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/forest_liana-2.0.0/lib/forest_liana/bootstraper.rb:74:in map'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/forest_liana-2.0.0/lib/forest_liana/bootstraper.rb:74:in create_factories' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/forest_liana-2.0.0/lib/forest_liana/bootstraper.rb:24:in perform'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/forest_liana-2.0.0/lib/forest_liana/engine.rb:51:in block in <class:Engine>'

I've rolled back by specifying gem 'forest_liana', '1.9.8' in Gemfile which works fine. Deploying to Heroku also fails with the same 'wrong constant name' error in the build logs.

Ruby 2.2.6p396
Rails 5.1.4
Postgresql
Puma 3.0
Windows 10 local/Heroku prod

[+] Polymorphism - Support Polymorphic Associations.

Hi there, let me start off with thanking you guys for the awesome project. it covered our use case almost end-to-end, lifted us up to work on business concerns.

Seeing you plan to support STI's in some point in future, I would like to know if you also plan to support polymorphic associations? For our use case, when we create new entities under related data, having to specify associated entity's type and id is quite error prone for editors, so support in forest level would be quite beneficiary I think.

204 No content during setup

Started GET "/forest" for ::1 at 2017-02-20 11:26:33 -0800
Processing by ForestLiana::ApimapsController#index as HTML
Completed 204 No Content in 0ms (ActiveRecord: 0.0ms)

Using Ruby 2.4 and Rails 5.0.1

Access only by segment Collection but

Hi,

Bug encountered with collections and segments display for collection where we specify access only by segments

This isn't important but you should be aware of it.

Expected behaviour

Lets take the example of this collection/segments:

[x] Venues
|--[ ] status editing
|--[x] status live
|--[x] status offline

NB: [x] stands for shows in the UI and [ ] stands for is hidden in the UI

When the user clicks on Venues we should see status live segment.

## Actual behavior

When the user clicks on Venues we see status editing instead.

$blank and $present filters broken

Parsed value is set to nil here.

And then here raises:

undefined method `to_sym' for nil:NilClass

forest_liana (1.3.15) app/services/forest_liana/operator_date_interval_parser.rb, line 19

   14       def initialize(value)
   15         @value = value
   16       end
   17   
   18       def is_interval_date_value
>  19         return true if PERIODS[@value.to_sym]
   20   
   21         match = PERIODS_LAST_X_DAYS.match(@value)
   22         return true if match && match[1]
   23   
   24         false

Forest and Single Table Inheritance

Forest doesn't recognize STI.
I would love to be able to have :

  • different layout configuration for sub-classes
  • automatic and magic creation of segments for each sub-class

[Crash] Forest with Rails 5.1.0.rc1

The first Release Candidate release of Rails 5.1 is here !

And here is the crash test with Forest. 💥

At app launch :

web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::ActionSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of ActionSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::ActionController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of ActionController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::ActionSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of ActionSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::ActionController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of ActionController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::ActionSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of ActionSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::ActionController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of ActionController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::ActionSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of ActionSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::ActionController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of ActionController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: already initialized constant ForestLiana::UserSpace::IntegrationSerializer
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/serializers/forest_liana/serializer_factory.rb:15: warning: previous definition of IntegrationSerializer was here
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: already initialized constant ForestLiana::IntegrationController
web_1     | /usr/local/bundle/gems/forest_liana-1.5.17/app/services/forest_liana/controller_factory.rb:11: warning: previous definition of IntegrationController was here
web_1     | => Booting Puma
web_1     | => Rails 5.1.0.rc1 application starting in development on http://0.0.0.0:3000
web_1     | => Run `rails server -h` for more startup options
web_1     | Puma starting in single mode...
web_1     | * Version 3.8.2 (ruby 2.4.1-p111), codename: Sassy Salamander
web_1     | * Min threads: 5, max threads: 5
web_1     | * Environment: development
web_1     | * Listening on tcp://0.0.0.0:3000
web_1     | Use Ctrl-C to stop

After a login attempt :

web_1     | Started POST "/forest/sessions" for 192.168.99.1 at 2017-03-27 16:19:53 +0000
web_1     |    (0.6ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
web_1     |   
web_1     | ActionController::RoutingError (uninitialized constant ForestLiana::ActionController::Base):
web_1     |   
web_1     | forest_liana (1.5.17controllers) forest_liana/sessions_controller.rb:2:in `<module:ForestLiana>'
web_1     | forest_liana (1.5.17controllers) forest_liana/sessions_controller.rb:1:in `<top (required)>'
web_1     | activesupport (5.1.0.rc1) lib/active_support/dependencies/interlock.rb:12:in `block in loading'
web_1     | activesupport (5.1.0.rc1) lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
web_1     | activesupport (5.1.0.rc1) lib/active_support/dependencies/interlock.rb:11:in `loading'
web_1     | activesupport (5.1.0.rc1) lib/active_support/inflector/methods.rb:271:in `const_get'
web_1     | activesupport (5.1.0.rc1) lib/active_support/inflector/methods.rb:271:in `block in constantize'
web_1     | activesupport (5.1.0.rc1) lib/active_support/inflector/methods.rb:267:in `each'
web_1     | activesupport (5.1.0.rc1) lib/active_support/inflector/methods.rb:267:in `inject'
web_1     | activesupport (5.1.0.rc1) lib/active_support/inflector/methods.rb:267:in `constantize'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/http/request.rb:82:in `controller_class'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/routing/route_set.rb:43:in `controller'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/routing/route_set.rb:29:in `serve'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/journey/router.rb:46:in `block in serve'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/journey/router.rb:33:in `each'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/journey/router.rb:33:in `serve'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/routing/route_set.rb:836:in `call'
web_1     | rack-cors (0.4.1) lib/rack/cors.rb:81:in `call'
web_1     | railties (5.1.0.rc1) lib/rails/engine.rb:522:in `call'
web_1     | railties (5.1.0.rc1) lib/rails/railtie.rb:185:in `public_send'
web_1     | railties (5.1.0.rc1) lib/rails/railtie.rb:185:in `method_missing'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/routing/mapper.rb:46:in `serve'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/journey/router.rb:46:in `block in serve'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/journey/router.rb:33:in `each'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/journey/router.rb:33:in `serve'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/routing/route_set.rb:836:in `call'
web_1     | rack (2.0.1) lib/rack/etag.rb:25:in `call'
web_1     | rack (2.0.1) lib/rack/conditional_get.rb:38:in `call'
web_1     | rack (2.0.1) lib/rack/head.rb:12:in `call'
web_1     | activerecord (5.1.0.rc1) lib/active_record/migration.rb:556:in `call'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
web_1     | activesupport (5.1.0.rc1) lib/active_support/callbacks.rb:97:in `run_callbacks'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/middleware/executor.rb:12:in `call'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
web_1     | railties (5.1.0.rc1) lib/rails/rack/logger.rb:36:in `call_app'
web_1     | railties (5.1.0.rc1) lib/rails/rack/logger.rb:24:in `block in call'
web_1     | activesupport (5.1.0.rc1) lib/active_support/tagged_logging.rb:69:in `block in tagged'
web_1     | activesupport (5.1.0.rc1) lib/active_support/tagged_logging.rb:26:in `tagged'
web_1     | activesupport (5.1.0.rc1) lib/active_support/tagged_logging.rb:69:in `tagged'
web_1     | railties (5.1.0.rc1) lib/rails/rack/logger.rb:24:in `call'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/middleware/request_id.rb:25:in `call'
web_1     | rack (2.0.1) lib/rack/runtime.rb:22:in `call'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/middleware/executor.rb:12:in `call'
web_1     | actionpack (5.1.0.rc1) lib/action_dispatch/middleware/static.rb:125:in `call'
web_1     | rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
web_1     | rack-cors (0.4.1) lib/rack/cors.rb:81:in `call'
web_1     | railties (5.1.0.rc1) lib/rails/engine.rb:522:in `call'
web_1     | puma (3.8.2) lib/puma/configuration.rb:224:in `call'
web_1     | puma (3.8.2) lib/puma/server.rb:600:in `handle_request'
web_1     | puma (3.8.2) lib/puma/server.rb:435:in `process_client'
web_1     | puma (3.8.2) lib/puma/server.rb:299:in `block in run'
web_1     | puma (3.8.2) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
web_1     | Error during failsafe response: uninitialized constant ForestLiana::ActionController::Base
web_1     |   /usr/local/bundle/gems/forest_liana-1.5.17/app/controllers/forest_liana/sessions_controller.rb:2:in `<module:ForestLiana>'
web_1     |   /usr/local/bundle/gems/forest_liana-1.5.17/app/controllers/forest_liana/sessions_controller.rb:1:in `<top (required)>'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/concurrency/share_lock.rb:149:in `exclusive'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/dependencies/interlock.rb:11:in `loading'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/inflector/methods.rb:271:in `const_get'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/inflector/methods.rb:271:in `block in constantize'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/inflector/methods.rb:267:in `each'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/inflector/methods.rb:267:in `inject'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/inflector/methods.rb:267:in `constantize'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/http/request.rb:82:in `controller_class'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/http/parameters.rb:88:in `set_binary_encoding'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/http/parameters.rb:58:in `parameters'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/http/mime_negotiation.rb:63:in `block in formats'
web_1     |   /usr/local/bundle/gems/rack-2.0.1/lib/rack/request.rb:57:in `fetch'
web_1     |   /usr/local/bundle/gems/rack-2.0.1/lib/rack/request.rb:57:in `fetch_header'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/http/mime_negotiation.rb:61:in `formats'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/middleware/public_exceptions.rb:22:in `call'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/middleware/show_exceptions.rb:49:in `render_exception'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/middleware/show_exceptions.rb:34:in `rescue in call'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
web_1     |   /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/rack/logger.rb:36:in `call_app'
web_1     |   /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/rack/logger.rb:24:in `block in call'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/tagged_logging.rb:69:in `block in tagged'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/tagged_logging.rb:26:in `tagged'
web_1     |   /usr/local/bundle/gems/activesupport-5.1.0.rc1/lib/active_support/tagged_logging.rb:69:in `tagged'
web_1     |   /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/rack/logger.rb:24:in `call'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/middleware/request_id.rb:25:in `call'
web_1     |   /usr/local/bundle/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/middleware/executor.rb:12:in `call'
web_1     |   /usr/local/bundle/gems/actionpack-5.1.0.rc1/lib/action_dispatch/middleware/static.rb:125:in `call'
web_1     |   /usr/local/bundle/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
web_1     |   /usr/local/bundle/gems/rack-cors-0.4.1/lib/rack/cors.rb:81:in `call'
web_1     |   /usr/local/bundle/gems/railties-5.1.0.rc1/lib/rails/engine.rb:522:in `call'
web_1     |   /usr/local/bundle/gems/puma-3.8.2/lib/puma/configuration.rb:224:in `call'
web_1     |   /usr/local/bundle/gems/puma-3.8.2/lib/puma/server.rb:600:in `handle_request'
web_1     |   /usr/local/bundle/gems/puma-3.8.2/lib/puma/server.rb:435:in `process_client'
web_1     |   /usr/local/bundle/gems/puma-3.8.2/lib/puma/server.rb:299:in `block in run'
web_1     |   /usr/local/bundle/gems/puma-3.8.2/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

Rails 4.0.3 installation failed due to config/secrets.yml

Step to reproduce :
rails -v @=> 4.0.3
bundle install
rails g forest_liana:install key

Instance method "destroyed?" is already defined in ActiveRecord::Base, use generic helper instead or set StateMachine::Machine.ignore_method_conflicts = true.
       route  mount ForestLiana::Engine => '/forest'
 initializer  forest_liana.rb

Forest generated a random authentication secret to secure the data access of your local project.
You can change it at any time in your config/secrets.yml file.

      insert  config/secrets.yml
/Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/actions/inject_into_file.rb:99:in `binread': No such file or directory @ rb_sysopen - /Users/antoine/code/orson-rb/config/secrets.yml (Errno::ENOENT)
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/actions/inject_into_file.rb:99:in `replace!'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/actions/inject_into_file.rb:60:in `invoke!'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/actions.rb:95:in `action'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/actions/inject_into_file.rb:31:in `insert_into_file'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@pikock-rb/gems/forest_liana-1.5.11/lib/generators/forest_liana/install_generator.rb:23:in `install'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `block in invoke_all'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `each'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `map'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `invoke_all'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/group.rb:233:in `dispatch'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@global/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@pikock-rb/gems/railties-4.0.3/lib/rails/generators.rb:156:in `invoke'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@pikock-rb/gems/railties-4.0.3/lib/rails/commands/generate.rb:11:in `<top (required)>'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@pikock-rb/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@pikock-rb/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `block in require'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@pikock-rb/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in `load_dependency'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@pikock-rb/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
	from /Users/antoine/.rvm/gems/ruby-2.1.5@pikock-rb/gems/railties-4.0.3/lib/rails/commands.rb:48:in `<top (required)>'
	from script/rails:6:in `require'
	from script/rails:6:in `<main>'

[*] Requests - The adapter operation aborted error

Expected behavior

A row successfully modifies or deletes when I want it to.

Actual behavior

Every time I try to modify or delete a row I get an error saying "the adapter operation was aborted"

Failure Logs

The developer console log says "response to preflight request doesn't pass access control check No 'access-control-allow-origin' header is present on details:1 requested resource."

Context

TODO: Please provide any relevant information about your setup.

  • Package Version:
  • Rails Version:
  • Database Dialect:
  • Database Version:

Smart fields, concatenate urls

Hello,

I would like to concatenate multiple links into a smart field:

class Forest::Venue
  include ForestLiana::Collection

  collection :venues

  field :urls, type: 'String' do
    "<a href=\"#{object.facebook_url}\">FB</a><a href=\"#{object.twitter_url}\">TW</a>"
  end
end
  • Any documentation available regarding the supported types for a smart field?
  • Any chance it could support HTML markup, maybe a field type HTML?

JSONAPI::Serializer monkey patch broken

Hi,

Last jsonapi-serializers release is breaking the gem.
Here's my Gemfile:

gem 'forest_liana', '~> 1.3', '>= 1.3.14'

Here's the error I get when I try to start my rails server:

/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/forest_liana-1.3.14/lib/forest_liana/bootstraper.rb:39:in `find_serializer_class_name': wrong number of arguments (2 for 1) (ArgumentError)

This is caused by this PR fotinakis/jsonapi-serializers#79

smart action, can't access my data

Expected behavior

Access my to my objects through Venus.all

Actual behavior

Getting an error NameError - uninitialized constant Forest::VenuesController::Venue:

Context

I create a smart action in my app and when I'm trying to access my models, it can't find them. I'm not sure where I went wrong.

routes

Rails.application.routes.draw do
  resources :venues, :only => [:show]
  root 'venues#index'
  namespace :forest do
    post '/actions/get-place-id' => 'venues#get_place_id'
    post '/actions/get-details' => 'venues#get_details'
  end
  mount ForestLiana::Engine => '/forest'
end

controller/forest/venues_controller.rb

class Forest::VenuesController < ForestLiana::ApplicationController
  def get_place_id
    puts Venues.all
    render json: { success: 'Data successfuly imported!' }
  end
end

lib/forest_liana/collections/venue.rb

class Forest::Venue
  include ForestLiana::Collection

  collection :venues

  field :number_of_food_types, type: 'Number' do
    object.food_types.length
  end

  field :urls, type: 'String' do
    "<a href=\"#{object.facebook_url}\">FB</a> <a href=\"#{object.twitter_url}\">TWT</a>"
  end

  action 'get place id'
  action 'get details'
end

Gemfile.lock

(...)
    forest_liana (1.9.7)
      arel-helpers
      bcrypt
      groupdate
      jsonapi-serializers (>= 0.14.0)
      jwt
      rack-cors
      rails (>= 4.0)
      useragent
(...)
  • Package Version: 1.9.7
  • Rails Version: 5.1.4
  • Database Dialect: pg
  • Database Version: (0.21.0)

[+] Smart Actions - Users want to pre-fill the form with the selected record values.

I'm trying to figure out from your documentation how I could use a field value in Smart Action field?

I tried

  action 'get gapi data', fields: [{
    field: 'query',
    type: 'String',
    isRequired: true,
    defaultValue: "#{object.name}",
    widget: 'text input'
  }]

I don't have that much hope that it is possible (due to the fact you can call a smart action on multiple records). But we never know.

[ISSUE] - Can not access my project dashboard after set-up

Hi there,

I set up Forest on my Rails app (rails 5), bundle and launch my server on localhost:3000. So far so good.

I am accessing successfully [(https://app.forestadmin.com/projects)]

Nevertheless, once picking my project, I am landing on a 500 (see screenshot).

No stack errors so far, everything's being rendered properly on server side.

1 error console tho, the following:

TypeError: Cannot read property 'indexOf' of null
    at redirect (client-8fcc46b….js:16)
    at g (vendor-6f66b2f….js:22)
    at o (vendor-6f66b2f….js:23)
    at A (vendor-6f66b2f….js:23)
    at k (vendor-6f66b2f….js:23)
    at E (vendor-6f66b2f….js:23)
    at invokeWithOnError (vendor-6f66b2f….js:7)
    at s.flush (vendor-6f66b2f….js:7)
    at l.flush (vendor-6f66b2f….js:7)
    at d.end (vendor-6f66b2f….js:7)

screen shot 2017-07-11 at 9 18 40 am

Thanks for your help, much appreciated,
Boris

[QUESTION] Implementation of a SmartCollections with a Ruby application

Hello guys,

I spent the night trying to create a basique "smart collections" for my application.
I explore the git of Forest-Rails-Demo with the Brands example.
But after hours of work i still have an error message "Cannot reach your data" when i'm trying to access the smart collections.

Here my code:

stage.rb

class Forest::Stage
  include ForestLiana::Collection

  collection :stages
  field :stage, type: 'String'
  field :count, type: 'Number'
end

stages_controller.rb

# ForestLiana::ApplicationController takes care of the authentication for you.
class Forest::StagesController < ForestLiana::ApplicationController
  def index
    records = Request.all

    if params[:search]
      records = records.where("brand ILIKE '%#{params[:search]}%'")
    end

    if params[:filter] && params[:filter][:stage]
      records = records.where(stage: params[:filter][:stage])
    end

    result = records
      .group(:language_request)
      .order(:language_request)
      .count
      .map.with_index do |f, index|
        {
          id: index,
          type: 'stages',
          attributes: {
            stage: f.first,
            count: f.second
          }
        }
      end
    render json: { data: result }
  end
end

config/routes

Rails.application.routes.draw do

  #forest set-up
  namespace :forest do
    resources :stages
  end
...

I have this kind of output

{"data":
  [
    { "id":0,
      "type":"stages",
      "attributes":
        {
          "stage":"",
          "count":5
        }
    },

    {"id":1,
      "type":"stages",
      "attributes":
        {
          "stage":"EN",
          "count":16
        }
    },

    {"id":2,
      "type":"stages",
      "attributes":
          {
            "stage":"FR",
            "count":22
          }
    },

    {"id":3,
      "type":"stages",
      "attributes":
          {
            "stage":"IT",
            "count":1
          }
    }
  ]
}

Can you tell me why the ForestAdmin cannot reach my data ?
Forest recognize the columns stage and count.
The others tables are available.

Thank you,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.