Displaying 2 results from an estimated 2 matches for "not_admin".
Did you mean:
net_admin
2006 May 31
3
validate unless, LoginGenerator difficulty
I apologize if this is a very simple question; I''ve searched the forums,
wiki, Google, and Agile Web Development with Rails to no avail.
Is there a way to put conditional validation in the model? For
instance, if I want to limit items a user can add unless the user is an
admin? My current code is:
validates_uniqueness_of :user_id, :scope => ''event_id'',
2006 May 10
0
Ezra''s acl_system2 and flash not getting populated in functional tests
...d
end
In the test:
ACTIONS = [:index, :new, :edit, :create, :update, :destroy]
def test_redirect_not_authenticated_user
ACTIONS.each do |a|
get a
assert_redirected_to :controller => ''account'', :action => ''login''
end
end
def test_redirect_not_admin
assert not_admin = User.authenticate("not_admin", "her_password")
ACTIONS.each do |a|
get a, {}, { :user => route_admin }, nil
assert_redirected_to :controller => "account", :action => "login"
#assert flash.has_key?(:message), &q...