Displaying 20 results from an estimated 6000 matches similar to: "Complex abilities and scoping of records"
2009 Jan 18
5
Modeling complex associations
Hi,
Is there any default way to model something like the following
situation in ActiveRecord?:
A company has_many :buildings which are associated to :company, e.g.
in a polymorphic way.
Moreover one and only one of the buildings is the company''s
headquarter.
Thinking in terms of the database, I''d prefer to add an owning
association, an thus have a has_many :buildings plus a
2010 Dec 02
8
CanCan issue when being very specific
So I got CanCan and Devise working well. I have two types of users:
Admins and Nonadmins. Admins can edit all of Nonadmins profiles.
The problem is, every user (either Admin or Nonadmin) belongs to an
Account or Organization. Admins should only be able to edit users from
their own Account or Organization. I was able to do that too.
The problem is, I can''t display the Create New User
2012 Mar 30
1
cancan breaks scoped mass assignment
Hi all,
I just installed cancan on a new project and found out that it creates
some problems with the new scoped mass assignment features of rails 3.2
.
Basically, in my User model I create some attr_accessible attributes in
order to avoid users to edit their roles or other sensitive information.
From the administration I allow admins to edit those protected
attributes by passing
2011 Mar 02
1
Setting CanCan ability.rs model
I successfully made login system with Devise and CanCan, and I have 3
types of users. Admin, internal and global users. I created
Controllers and index actions: Admin, Cpanel, Report and State, and I
want to restrict access to this controllers for some users.
Admin user should have privilegies to access: Reports(all), State
(read), Admin (all)
Global user should have privilegies to access:
2008 Sep 06
6
Configuring custom library
Hi,
I''ve added a custom library called lib\AccountSystem like so:
"module AccountSystem
SINGLE = 1
MULTIPLE = 2
class << self
attr_accessor :account_system_type
end
end"
Now I wanna configure
AccountSystem.account_system_type=AccountSystem::SINGLE in one app. I
used an initializer: config/initializers/account_initialization.rb
where I put this line in.
I
2006 Feb 08
10
Writing activex controls and dlls in ruby.
Is it possible to write activex controls and windows DLLs in ruby? I
would like to have some of my logic be usable from VB (don''t ask why).
Thanks.
2009 Jun 10
5
uninitialized constant ActiveSupport::Cache (NameError)
Hi
After having updated some GEMS I get `load_missing_constant'':
uninitialized constant ActiveSupport::Cache (NameError) on starting
the server of a freshly generated rails project.
Before, I already had Rails 2.3.2 projects succesfully running, now
all of them generate this error.
These are my GEMS:
actionmailer (2.3.2, 2.2.2, 2.1.2, 2.1.1, 2.1.0)
actionpack (2.3.2, 2.2.2, 2.1.2,
2011 Nov 28
4
getting a subdomain name in model.
Hi all,
I am facing problem in getting subdomain name inside the model. The
following is my setup.
I am using cancan for authorization.I wanted a specific condition in
Ability.rb ( the file which is placed in models if we install cancan gem).
Below is the condition I wanted:
=========================================================
user ||= User.new # guest user (not logged in)
if
2013 Feb 18
6
How to clear ActiveRecord query cache on associations with dynamic table
In part of my application I''m using dynamic tables. I''m aware of the single
thread conditions. I''ve tackled some caveats yet - will post a blog about
it soon - but there''s one I need help with.
Consider 2 models that are associated: Order and OrderLine where Order has
many order_lines.
Now we set the table names for them:
2004 Jan 11
1
Re: Asterisk-Users digest, Vol 1 #2448 - 10 msgs
John,
Pounds
Sterling
Screw You (purely optional :-)
Your Call Is Being Connected
Please Wait
Sorry, Your Call Will Be Answered Soon
Your Call Is Important. (That is why we have not yet bothered to answer
it, instead dancing around the office high on tip-ex.)
And for the girlfriend filter:
Sorry, that number has not been recognized. Please hangup and try again.
or
This number is no longer in
2011 Jun 05
1
Cancan redirect back at AccessDenied
Hello
I have a rails 3 app and I am trying to implement the redirect back
action at access denied for cancan.
If I try this in my application_controller:
rescue_from CanCan::AccessDenied do |exception|
redirect_to :back
end
It gives the following error:
No HTTP_REFERER was set in the request to this action, so
redirect_to :back could not be called successfully. If this is a test,
make sure
2012 Apr 05
5
rspec: identical tests fails when repeated
I''m doing RSpec controller testing with CanCan authorization, and I''m
seeing something I''ve never seen in RSpec before: the same test run
twice fails on the second one. I am NOT doing before(:all) or other
things that should cause state to persist between tests:
Here''s the relevant code:
context "POST create" do
context "with user logged
2012 Oct 09
8
unexpected should_receive behaviour
Hi,
surely I''m missing something... but what!?
in my spec I''ve
User.should_receive(:find).with("1").and_return(@user)
and in my controller
User.find(params[:id])
green light... correct...
but if I change my controller using another method, for example first:
User.first
or even
User.all
I get green light too... I was expecting an error like
expected: 1 time
2002 Mar 29
7
"weight" parameter in htb?
Hello,
I''ve been using cbq''s "weight" parameter to influence distribution of
excess bandwidth among sibling classes. Does htb offer something
similar?
So far I think that
- you either use priorities - then excess bandwidth is offered to higher
priority classes first, the rest (if any) is distributed among lower
priority classes
- or you don''t use
2013 Nov 22
2
Cancan Rspec load_and_authorize_resource
Hello!
While running bundle exec rake, I receive following error (see in
attached file)
However, my tests are steel passing with command rspec spec/controllers/
Some info:
ads_controller.rb:
class AdsController < ApplicationController
load_and_authorize_resource except: :create
end
ads_controller_spec.rb:
require ''spec_helper''
describe AdsController do
render_views
2006 Apr 20
7
Rails + postgres case insensitive searches.
Hello all
I am wondering how rails handles case sensitivity in databases. If I
do a Person.find_all_by_name("tim") in mysql I would expect to get
tim, TIm, and Tim. Do I only get tim in postgres?
How do other people deal with this? Do you resort to find_by_sql for
all your postgres queries to get case insensitive results?
2010 Jun 02
5
user routing versus admin routing strategies?
In an app where ordinary users are limited to viewing and editing their
own "stuff", but someone with admin privs can view and edit anybody''s
stuff, what''s the right strategy for routing?
At first blush, I''d think that an ordinary user (e.g. with id 565)
should see something like:
http://example.com/mystuff.html
... where the controller assumes
2006 Apr 18
3
Capistrano from windows to linux.
There seems to be a bug when deploying a rails application developed
in windows to a linux box. The rake deploy command attempts to run the
command "/install/path/current/script/process/reaper" but the files do
not have the execute bit set.
What can I do to make sure either the execute bit is run or prepend
the command with sh or ruby?
Thanks.
2015 Mar 21
2
Help needed with Tinc Setup on remote hosts and lots of ISPs / Failover Problems between ISPs
Hello List,
This is our setup which we are trying in a couple of our remote offices:
+---------------------------------------+ +-------------------------------------------------------------+
| | | |
| +----------------+ |
2013 Jul 09
3
routes for devise in rails4
hi all,
i am using 3 devises for 3 models in rails4.
i need routes to my devise models.the devises are client,admin,employee.
when i login into client then it will go to clients dashboard, when i
login into admin then it will go to admins dashboard, the employee also
has the employee dashboard.
if i do not enter any login then the common dashboard body message is
please signin.
please let me