Displaying 20 results from an estimated 500 matches similar to: "null object pattern"
2008 May 21
8
before_filter with multiple roles
I have multiple roles in my application.
Now I want to block a method for all users except the administrator and
a manager.
When I do this:
before_filter (:check_administrator_role), :only => [:administration]
before_filter (:check_taskmanager_role), :only => [:administration]
The user must have both roles. How can I change that to an "OR"
combination?
--
Posted via
2006 Jul 11
1
Problems using the authorization plugin from Bill Katz
Hello everyone,
I was trying to set up access control in a new application Im working on,
I''m trying to use the excellent authorization plugin from Bill Katz,
Its pretty straight forward to setup and should be to use.
But when i try to give the same permission on two differents users on
the same object i get an error.
(Well , Im kinda new to all this rails stuff)
r = Red.find(1)
u1 =
2007 Jul 24
6
Mocking Access Control
I''m trying to jump on the TDD/BDD bandwagon, but am having trouble
understanding how i should mock my user. The user has a habtm
relationship to a roles model (acl_system2 plugin), but I''m not sure
how to tell rspec about a model.
My code:
describe UsersController do
integrate_views
before(:each) do
@user = mock_model(User)
2007 Oct 12
6
abstract_class... what exactly does it do
Hi,
Does anyone know much about abstract_class? Does it actually prevent
instances of the class from being created? Does it disable certain
methods? I already know what it''s for, but I want to know what setting
self.abstract_class=true actually does.
The reason I ask is that I want to use it for a slightly unorthodox
purpose. I want a class who''s only attributes are its
2006 Oct 09
5
Problem setting variables in ApplicationController.
I''m dynamically generating menu options based on the currently logged
in user: current_user.
My menus are setup on the applicatin.rhtml file. The current_user is
defined in the application controller. But, attempting to assign it a
value while in the application controller results in an ''undefined
method'' error.
ApplicationController ....
def current_user
@cu =
2015 Feb 02
3
A good way to debug a c++ library embedded to R code
Dear all,
I am using R CMD SHLIB to compile a c++ code into a library (.so) and
dyn.load to load this library into a R code. I am facing some problems in
the c++ code that I can not figure out how to solve. Do you recomend any
good way to debug this R + C++ program? If I was programming only in C++ I
would use GDB.
I would much appreciate any help or suggestion!
Best regards,
Charles
--
Um
2003 Mar 21
2
not enough virtual memory
Greetings,
I have been trying to install Cool Edit Pro 1.2. I'm running
Mandrake 8.1, which came with Wine release 20010731. This is a
dual-boot system with MS-DOS 6.22 in addition to Mandrake 8.1.
There NO version of Windoze of any kind is installed. I have 512
MB of RAM; the DOS partition has 941 MB free and 777 permissions.
I mount the CD-ROM drive, cd to it, and execute wine setup.exe
2008 Dec 09
7
subclassing vs mixins, which one should be used?
Hey all,
I have two models in my rails project that share a lot of traits. They
each have the same 4 properties, and now I need to add 2-3 methods to
each one that will be the same. In the spirit of DRY I am looking for
a solution to write these methods only once.
Both of these models already inherit from ActiveRecord . . . and I
didn''t know if it was safe to just "whip up" a
2009 Oct 09
1
[PATCH node] validify ipv4/ipv6 static/dhcp choice else loop
If you select an option that's not listed during ipv4/ipv6 setup it will accept it without verification. This corrects that behavior and forces a valid option to be picked.
---
scripts/ovirt-config-networking | 106 +++++++++++++++++++++------------------
1 files changed, 58 insertions(+), 48 deletions(-)
diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
index
2015 Feb 02
1
A good way to debug a c++ library embedded to R code
----- Original Message -----
> From: "Gabriel Becker" <gmbecker at ucdavis.edu>
> To: "Charles Novaes de Santana" <charles.santana at gmail.com>
> Cc: "r-devel" <r-devel at r-project.org>
> Sent: Monday, February 2, 2015 12:02:27 PM
> Subject: Re: [Rd] A good way to debug a c++ library embedded to R code
>
> Charles,
>
>
2006 Mar 28
12
cached-model broken with Rails 1.1
It looks like cached-model is broken again under rails 1.1. Can anyone
confirm? Note that the exception below indicates it''s trying to treat
CachedModel as the class name of the model, rather than using the proper
class name (which is Entry in this case, and the table called entries).
This is a model using Single Table Inheritance and acts_as_tree, and
worked just fine under 1.0 and
2007 Aug 10
1
How to spec a model method
Still new to Specs...
How do I create a spec to test a model method? Specifically, here is my
spec:
#testing model
describe User do
it "should have many user roles" do
User.reflect_on_association(:user_roles).should_not be_nil
end
it "should have many roles though user roles" do
User.reflect_on_association(:roles).should_not be_nil
end
it "should know
2007 Oct 14
5
Ruby/Informix 0.6.1 released
This is a maintenance release to fix a bug triggered while working
with Ruby on Rails and Informix.
Web site: http://ruby-informix.rubyforge.org
Changelog:
0.6.1 13/10/2007
------------------
Bugs fixed:
* Database#columns was returning an empty array from within
the
Informix ActiveRecord adapter
(ActiveRecord::ConnectionAdapters::InformixAdapter#columns)
if
2012 Oct 12
3
Columns and rows
Hi,
Could you please advice some easy way to do the following for a dataframe
(header=F) having unequal column- & row- length.
1. Combine/stack/join contents from -
a) multiple rows into one column.
b) multiple columns into one row.
2. Stack contents from multiple columns (or, rows) into one column (or,
row).
Thank you.
Cheers,
Santana
[[alternative HTML
2010 Jan 27
1
around_filter and with_scope
i got two controller (with restful actions) where my code is quite
ugly and not very dry. every action looks quite like this:
if @logged_user.has_role?("admin")
User.find(params[:id)
else
@logged_user.group.user.find(params[:id])
this is a security check that enforce a simple spec: normal user
should read/write information only about their group''s users, but
2007 Sep 29
8
Inheritance problem in model
Hello,
I''ve got a problem with the inheritance as soon as I try to use it in a
model.
I''ve got plenty of items which can share a lot of code, so I created a
class "Item", which inherits from ActiveRecord::Base, but because it''s
not a "real item" but an interface, I set it abstract (writing
abstract_class? method).
Then I have all the differents
2007 May 03
2
How to run a cpu intensive ruby script with rails functionality
Hi All,
I am new to this list and to rails. So far I am loving the way in
which it is easy to put together web pages with a database backend.
I would love to use the rails functionality (to do the sql queries)
and then process the results using some very cpu intensuve tasks. The
results will take far longer than it is viable to use a web browser to
view the results. I would like to see the
2013 Apr 16
7
puppet-cleaner: makes puppet DSL code comply with a subset of the style guide
FWIW,
I''ve wrote puppet-cleaner to help me make comply thousands of lines of
puppet 2.6 DSL code to puppet 2.7 style guide and expectations. I''m
uploading it to github today for anyone to use.
https://github.com/santana/puppet-cleaner
Externally, you run puppet-clean file.pp and it can transform this:
/*
multiline comment
trailing white space here ->
*/
class
2009 Feb 25
3
Secure but elegant destruction method
Hi,-
I am looking for a clean and secure way for an ActiveRecord instance to
delete itself. Say I have a User model in my app. Then the destructive
action would be /users/user_id/destroy. If this action is not secured by
a filter like:
(*) before_filter :check_administrator_role, :only => :destroy
then any user could potentially log in and start issuing:
/users/1/destroy
/users/2/destroy
.
2013 Jan 02
2
In which column and in which row a number is in a matrix
Dear all, Happy New Year for all of you! I hope we have an year of
essential freedom for everyone!
I am trying to manipulate a matrix in order to know in which column
and in which row a number is allocated. But, when we use the function
"which" it returns the position of the number in the "vector
representation of the matrix". For example:
>