ForestAdmin / forest-rails

💎 Ruby on Rails agent for Forest Admin to integrate directly to your existing Ruby on Rails backend application.
https://www.forestadmin.com
GNU General Public License v3.0
374 stars 77 forks source link

[-] Smart Actions - Missing record id in the pre-fill function context #262

Closed tvilon closed 6 years ago

tvilon commented 6 years ago

https://doc.forestadmin.com/developer-guide/rails.html#prefill-a-form-with-default-values

Expected behavior

Be able to identify current record when receiving a call for default values

Actual behavior

The request parameters does not include the record id

Started POST "/forest/actions/my_action/values" for ::1 at 2018-06-10 13:32:57 +0200
Processing by Forest::OrganizationsController#my_action_values as HTML
  Parameters: {"data"=>{"attributes"=>{"values"=>{ ALL_RECORD_ATTRIBUTES_EXCEPT_ID  , "__meta__"=>{}}}, "type"=>"custom-action-values-requests"}, "organization"=>{"data"=>{"attributes"=>{"values"=>{ALL_RECORD_ATTRIBUTES_EXCEPT_ID, "__meta__"=>{}}}, "type"=>"custom-action-values-requests"}}}

Failure Logs

no failure just unable to do something like organization = ::Organization.find(params.dig('data', 'attributes', 'ids')[0])

Context

arnaudbesnier commented 6 years ago

Thanks for the feedback @tvilon, the improvement is now released in production. You don't need any liana upgrade, as the fix has been done on the Forest client app.

Enjoy!

🌲🌲🌲