« Newer Snippets
Older Snippets »
1 total  XML / RSS feed 

scope in activerecord

arount_filter ScopeAccess::Filter.new(Secret,:mine) 


def mine 
   {:find=>{:conditions=>["user_id=?",1]}, :create=>{:user_id=>1}} 
end 


def index 
   @secrets=Secret.find(:all) 
end 


def new 
   secret = Secret.create(:name=>rand(10000)) 
   if (secret.new_record?) 
     flash[:notice] = "Could not create Secret" 
   end 
   redirect_to :action=>"index" 
end 

« Newer Snippets
Older Snippets »
1 total  XML / RSS feed