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
Never been to CodeSnippets 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)
You need to create an account or log in to post comments to this site.
Related Posts
» Создание значеÐ... in rails activerecord models
» Simple accessor method for A... in ruby rails activerecord
» acts_as_state_machine model in ruby rails activerecord state acts_as_state_machine
» ActiveRecord reconnect to da... in ruby rails activerecord console ar merb orm reconnect
» Typo under lighttpd in lighttpd ruby rails typo ruby-fcgi
» Locking your Rails app to sp... in rails gems environments version locking
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails