I am a fairly new Rails developer, allso i begun to develop with angular
as
it gives sense and clarity.
I have come up to a bit of a problem. I use CANCAN to manage user->role
wrights, but now it
gives me a very hard time to implement with angular in cases where i
have a
repeater, as i need to
tell if the user can edit,delete or view that specific row.
The rails way is simple:
if can? :edit,script
%a{:href=>edit_script_path(script)}
edit
to do this in angular i came up with an idea to go through the results
that
came from db, and then simply add an
attribute can_edit, can_view eg.
@scripts.each do |script|
script[:can_edit]=can?(:edit,script)
end
But then i get the Depriciation warning for adding arbitary attributes
to
active records.
To add the cancan rules on the clinet side is just double trouble.
Is there a way to set attributes on active record?