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?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/8w3fzoOqNZoJ.
For more options, visit https://groups.google.com/groups/opt_out.