Displaying 20 results from an estimated 10000 matches similar to: "Limiting a user''s view of data"
2006 Mar 04
4
authorization framework?
There are a number of good authentication frameworks for rails - has anyone
developed a generic authorization framework?
I''m thinking of something that included the concept of roles, mapped roles
to both actions and users and could be used to wrap actions before their
invocation.
Extra good would be some way to check data permissions (as in, "yes you can
perform the ''Edit
2006 Mar 13
8
Nested find(:all, :include => ) statements
Is there a way for me to do:
OrderItem.find(:all, :include => [:user, :product => [:supplier]]
So I don''t have a supplier_id on my order_item, but have it on my
product, which is part of order_item.
Joerg
--
Posted via http://www.ruby-forum.com/.
2007 Mar 22
2
Enumerable sum oddity
Hi.
In this setup "account has_many :consultations". Can anyone explain
the following behaviour to me? Rails 1.2.2. The "sum" method should
return 0 for an empty array.
>> a = Account.find(1)
=> #<Account:0x39c80a8 @attributes={...}
>> a.consultations
=> []
>> a.consultations.sum(&:foo)
ArgumentError: wrong number of arguments (1 for 2)
2006 Jul 23
4
Anything like with_scope for ActionController?
There are areas of my application that "want" to use a url structure
like
domain/<human_readable_param>/<Module>/<Controller>/<Action>/<Id>
Please note that the human readable parameter I need to inject is NOT
related to the <id> being used by the action/controller pair. It''s
identifying a container object whose contains are operated
2006 Jan 10
1
Problem with belongs_to
I have a model where I have a tree of nodes in one table (acts_as_tree)
where I also use a type column to get inheritance. In this table I also
have a data_id column that refers to another row in another table (the
subclass knows what table).
I also have another class that have this line
class Page < ActiveRecord::Base
belongs_to :node,
:foreign_key =>
2006 Nov 01
17
So how can I rewrite my app without using with_scope?
So, I hear that with_scope is going to be deprecated.
Which is a bit of a shame, given the stuff I''ve been writing recently.
I have a CMS with multiple clients. A ''client'' is essentially a
company, with multiple users. Content on the site belongs to a client
- content could be messages, images, schedules, etc etc. People
belonging to one client should not be able
2006 Jul 14
5
Acts_As_Taggable Plugin multiple controllers.
I have Acts_As_Taggable Plugin working. I have a HR controller and a
sales controller.
I have a document in hr tagged whitepaper and a differnent document in
sales tagged whitepaper
when I am in hr I see the hr document tagged with whitepaper and not
the sale document (what I want). but if I click on the tag whitepaper
I return two documents, hr and sales. I just want to return the hr
document
2005 Dec 20
0
db/schema.rb and PostgreSQL sequences
Hello.
I''m working the "proper way" with creating the initial db schema via
migrations and db/schema.rb.
However, I have a bit of a special need, and need to know if anyone
knows the solution to this;
I need a sequence that is common to several tables - a "data id" that
gives a sort of unique object number to every row in every table. Some
associated tables (a
2007 Nov 02
0
RMySQL inserting data problem
Hello,
I am trying to insert data in a data.frame into a database table using the RMySQL package
m <- dbDriver("MySQL")
con <- dbConnect(m, host = "blah", user = "blah", password = "blah", dbname = "blah")
proid <- dbGetQuery(con, "select max(processed_data_id)+1 from processed_data")
spot <-
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
(
2008 Jun 01
2
Is Ezra''s RESTful recipe needed anymore?
Hi all,
In the recent Advanced Rails Recipes book, Ezra states that Rails needs a
little bit of adjustment for its restful routing to work with Facebook. He
suggests created an initializer named facebook_overrides.rb and adding this
code:
http://pastie.caboo.se/206696
But I was just testing restful routing without that code, and Rails seemed
to be working fine with Facebook.
2006 Aug 11
3
Rails Documentation is RoR''s achilles heel
Hi All
Just a few minutes back I came across a post about autotest/zentest and that
post reignited the feeling I get when I look at RDoc, RoR documentation.
The main thing that is lacking in RoR and to some extent Ruby''s RDoc is
showing method names in HTML is not documentation. The arguments to method,
exception/errors raised by method, return value and a usage example
completes the
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
2006 Dec 31
2
what''s with the response.should_be_xxxx stacktrace?
If I do
get :index
response.should_be_success
I get about 20k of marshalled dumpage that starts like
#<ActionController::TestResponse:0x390443c @body=\"<html><body>You
are being <a href=\"http://test.host/carts/1\">redirected</a>.</body></html>\",
@assigns=[], @redirected_to={:action=>\"show\", :id=>1},
2007 Aug 21
3
Eager Loading
is there a way to always eagerly load an associated object so that you
don''t have to put :include into every finder?
class Product <ActiveRecord::Base
belongs_to :user #always load user when product is loaded
end
Product.find(1).user.login
#1 query since user was loaded with the product, same as if i
used :include but I don''t want to have to specify it everywhere.
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
2010 Dec 16
12
Capybara + radio buttons
How do I select a radio button when both id and name are identical?:
<input type="radio" name="BILFPB.bilPremieUppgifterFI.under24"
tabindex="13" value="J24" checked="checked" id="forare">Ja
<input type="radio" name="BILFPB.bilPremieUppgifterFI.under24"
tabindex="14" value="N24"
2009 Apr 19
19
Controller spec: testing that scope is set
In a Rails controller I set the scope on a model class in an around
filter. I have defined expectations on the model classes, and ideally, I
would add a further expectation for the scope. Is this already possible
in some way? How would I go about adding support a scope expectation?
Michael
--
Michael Schuerig
mailto:michael at schuerig.de
http://www.schuerig.de/michael/
2008 Jan 11
5
changes in rspec''s trunk and autotest
This applies to anyone using rspec''s trunk from >= 3220 with ZenTest <= 3.7.2.
Anyone else, feel free to move on....
The next release of ZenTest, coming soon, includes some changes that
improve the relationship between Autotest, it''s subclasses (like those
in rspec) and .autotest, the file that you can use to plug into
autotest''s hooks to extend/modify