similar to: Dynamic Scope plugin

Displaying 20 results from an estimated 7000 matches similar to: "Dynamic Scope plugin"

2006 Jul 24
1
meantime_filter won''t pick up my missing methods
<code><pre> module Scope protected def method_missing(method_id, *arguments, &block) if method_id.id2name =~ /^scope_([_a-z]\w*)_to_([_a-z]\w*)/ scope_model($1.singularize.capitalize, "#{$2}_id", &block) else super end end def scope_model(klass, foreign_key, &block) eval(klass).with_scope({ :find =>
2007 Oct 18
9
with_scope issue
I have the following code: class User < ActiveRecord::Base has_many :requests do def find_active(options = {}) with_scope :find => { :conditions => ["requests.active = ?", true] } do find(:all, options) end end end end Executing user.requests.find_active results in the following SQL: SELECT * FROM requests WHERE (( requests.user_id = 10 ) AND (
2020 May 14
0
[Dovecot v2.3.9.3] HTTP API Endpoint for mailbox cryptokey operations
Hello everyone, I successfully set up the mail_crypt plugin using folder keys, and require user's key to be encrypted with a password using mail_crypt_require_encrypted_user_key = yes. As I'm trying to streamline the process of creating a user, and want to develop an application in PHP to help me in that process, I'm very interested in the doveadm HTTP API. Although the
2006 Jul 02
11
Rails Plugin: meantime_filter for controllers (actions within blocks)
Hello, I just finished writing a plugin for Rails that I''m annoucing the first release here: meantime_filter. It is descibed at http://roman2k.free.fr/rails/meantime_filter/0.1.0/ rdoc/ (See the end of this message for getting it.) ABOUT THE PLUGIN It extends ActionController to add the functionnality of having filters run at the action call time. This new type of filter yields
2006 Nov 27
0
how to select with a kind of through relation(has_one)
I have a select issue with my members, my database structure is below User has many shops Shop belongs to a membership Shop has many items For front page I want to show items where membership of the shop has ad_enabled and this is what I have in mind but it returns with "Association named ''membership'' was not found; perhaps you misspelled it?" I tried to add to Item
2006 Sep 08
1
has_many relationship extensions and scoping rules
Hi all ! Is this supposed to work ? class Email < ActiveRecord::Base has_many :to, :class_name => 'Recipient', :conditions => "recipients.source = 'to'" do def create!(*args) with_scope(:create => {:source => 'to'}) do super end end def build(*args) with_scope(:create => {:source => 'to'}) do
2006 Nov 21
2
Accessing scopes
If with_scope has been called previously, how do I access the find conditions dynamically? I am asking because I am using a find_by_sql call (which clobbers the with_scope). How can I access the method scoping so that I can read it and incorporate it into my query manually? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google
2006 Mar 02
3
Modifying "Find" to always add a condition?
I''d like to always add a condition to any version of "find" (e.g. Thing.find(), Thing.find_by_name(), Thing.find_by_whatever) so that in addition to whatever conditions are set, an additional condition is set :conditions=>"user_id=#{current_user.id}" I''d like to make sure that a user only sees/edits/creates entries in the database that have the user_id
2006 Apr 01
1
STI with_scope on parent - bug or feature?
Hi, It seems that setting a with_scope on the parent class doesn''t do anything MyClass.with_scope(:find=>{:conditions=> ["somecol = ?", ''val'']}) do @ext_pages, @ext_rows = paginate :my_extended_class, { :per_page => 13 } end # this doesn''t generate WHERE somecol=''val'' In order for scope to work you have to call
2009 Dec 03
2
Dynamic Paths
Hey there, I''m in the muck of a major rails project, and need a bit of advice. Google isn''t much help in this case, so I came here. I''m trying to set up a URL structure as follows: url.com/username/blog/post_id where the user has_many posts and the post belongs_to user. I''m using the friendly_id plugin to enable easy lookup with the user''s username,
2006 Jul 23
0
[PATCH] (+tests) with_scope :order doesn''t work with included associations
(I''ve had this patch lying around for a couple of weeks, waiting for Trac to come back up. noradio''s already had a look at it on IRC. What''s the best way to submit patches while Trac is down?) with_scope doesn''t support :order in the presence of :include. For example: {{{ # We''re testing the interaction between :order, :include, and
2006 Apr 03
0
with_scope used in a has_many :through model
Hi there, I have something like the following: class Person < AR:B ... ... has_many :votes has_many :chosen_answers, :through => :votes, :source => :answer, :select => ''DISTINCT answers.*'' do def my_answers(whodunnit) chosen_answers.with_scope(:find => { :conditions => [ "votes.created_by=?", whodunnit ] }) do chosen_answers.find :all
2006 Mar 02
0
EdgeRails with_scope and :select
>From what i can gather the with_scope feature doesn''t allow you to specify which columns get selected. It appears to default to "*". So if i specify something like: Question.with_scope( :find => { :from => "questions q, answers a", :conditions => "q.owner = a.owner AND a.owner=1" }) do ... end I''ll generate SQL like: SELECT *
2006 Mar 30
4
with_scope and filters for Rails 1.1 (scoped_access plugin)
Has anyone successfully gotten the scoped_access[1] plugin to work in Rails 1.1? Some of the methods it was relying on are now no longer accessible. It seems the only way to add scope is to use the ''with_scope'' method that takes a block, but since Rails doesn''t have real around filters[2] I cannot see a way of adding a scope using a filter. Anyone using with_scope
2006 Aug 18
9
Rails is doing what I want - but I don''t understand how.
Hi guys, I have the strangest thing happening. The funny part is its doing exactly what I want to do, I just don''t understand how. Basically here is my model. class Role < ActiveRecord::Base has_and_belongs_to_many :users has_and_belongs_to_many :rights def self.names names = Array.new() for role in Role.find :all names << role.name end return
2007 Dec 20
0
Fwd: [ mocha-Patches-16424 ] Ruby 1.9 Compatibility
---------- Forwarded message ---------- From: noreply at rubyforge.org <noreply at rubyforge.org> Date: 20 Dec 2007 15:48 Subject: [ mocha-Patches-16424 ] Ruby 1.9 Compatibility To: noreply at rubyforge.org Patches item #16424, was opened at 2007-12-19 02:43 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7479&aid=16424&group_id=1917 Category: None
2006 Apr 12
2
Why doesn''t acts_as_tree support :scope?
I want to implement a unique category tree per user in my system, and I was hoping to use "acts_as_tree" on my category model. It seems as if acts_as_tree makes the assumption that the entire table the model is off of is one large tree. I actually want each user to have their own category trees all stored in the category table so I need it to scope off of the user_id.
2006 Jun 26
0
How to limit access to model objects based on role?
Hi all, I want to limit access to model objects based on the role of the logged in user. It seemed the most blunt way of doing this would be make copies of each controller which accessed the models and use one of the access control systems out there to limit access to the controllers. However, with 9 different controllers this seems like a terrible choice. Here''s what I''ve
2007 Jan 08
0
[PATCH] auto_discovery_link_tag with more bacon!
Could a core member please check out ticket #6941? Makes auto_discovery_link_tag accept tons more content types. auto_discovery_link_tag :xml, formatted_posts_url(:xml) => <link href="http://localhost:3000/posts.xml" rel="alternate" title="RSS" type="application/xml" /> -- Josh Peek http://joshpeek.com/
2012 Oct 10
1
Clarifications on Pigeonhole and MySQL lookups
Hello, we're scouting if it's possible to use Pigeonhole (currently v0.3.1, as this will be provided with an upcoming Debian package) with MySQL dict lookups with the mail setup we're designing. Our (main) goals are: 1. store the filters on the database 2. allow each user to enable/disable any of the filters set we provide (it's a static set of some general filters, available