Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

scope in activerecord (See related posts)

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 


You need to create an account or log in to post comments to this site.


Related Posts