Ask for Help
“How do you restrict access to particular fields in a model by user (e.g. admin user versus regular user)?”
The CanCan gem can do this.
“How exactly does Active Support find helper files when injecting them into view contexts? The goal is to add helper files into view contexts without using ActionController.”
There was no immediate answer; some pivots are going to look into this.
Interesting Things
- An Xcode update (4.0) has end-of-life’d hwprefs, which older versions of the parallel_tests gem require. The solution is to upgrade to the newest version of the parallel_tests gem or to place the shell script below somewhere within your search path.
#!/bin/sh case $1 in 'thread_count') sysctl -n hw.ncpu esac
Events
- Code for America is having an Open House tonight more info..
- SF Ruby is having a hack night tomorrow at TrueCar more info..
“How do you restrict access to particular fields in a model by user (e.g. admin user versus regular user)?”
New in Rails 3.1 is scoped mass assignment.
attr_accessible :role, :as => :admin
June 7, 2011 at 11:14 am
“How do you restrict access to particular fields in a model by user (e.g. admin user versus regular user)?”
It appears that this functionnality is only implemented in cancan 2.0 which is still in beta yet. Is CanCan 2.0 stbale for you ? I hesitated using it even though this functionnality would be pretty useful for me.
June 7, 2011 at 1:21 pm