metaminded / tabulatr2

A very JS enhanced Tabulatr edition. Rails4, Ruby 2 required
Other
21 stars 10 forks source link

How to use current_user/pundit conditions in Tabulatr::Data? #49

Closed mlt closed 7 years ago

mlt commented 7 years ago

Hi! I'm curious if there is a way to define buttons conditionally and/or set html attributes (disabled class) while defining data. It seems that I can't access my current_user or policy from Tabulatr::Data derived class. I started SO question as well.

mlt commented 7 years ago

@controller.policy(r) works alright for pundit and buttons

mlt commented 7 years ago

It would be nice to mention it in the readme though...

Crunch09 commented 7 years ago

@mlt Thanks! Want to submit a PR to include it in the README?

mlt commented 7 years ago

It seems that @controller is inaccessible from custom filter. Is it possible to make controller / session store accessible from filter block in data proxy? I have a certain validity period for records and I want to show active record with a respect to "now" that user can alter.