Forum: Ruby on Rails table less model

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2009-06-02 05:31
(Received via mailing list)
I want to have a simple model without a table for ACL purposes because
there aren't going to be many methods at all.

How could I have a Model like...

ControllerMethod securitylevel

users_list       8
reports_ar       6
ar_print_checks  7

so I can use retrieve and use these values in a before_filter in
ApplicationController.rb? The intent is to create a lightweight ACL
system.

I don't see the need to actually create a table or store the data in a
table at all.

Any suggestions on how I can accomplish this?

Craig


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
885ac43bca92fc2b1034356f3283e788?d=identicon&s=25 pharrington (Guest)
on 2009-06-02 06:16
(Received via mailing list)
If your model isn't abstracting the DB in anyway, just don't have it
inherent from ActiveRecord::Base... or perhaps I'm not understanding
part of your question?
Dd2d775dea75b381edb1bbf0600a0907?d=identicon&s=25 Marnen Laibow-Koser (marnen)
on 2009-06-02 06:25
pharrington wrote:
> If your model isn't abstracting the DB in anyway, just don't have it
> inherent from ActiveRecord::Base...

Exactly.  Also, I recommend that you (the OP, that is) take a look at
Authlogic, which uses a tableless model for user authentication; perhaps
it will do what you want.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2009-06-03 00:43
(Received via mailing list)
On Tue, 2009-06-02 at 06:25 +0200, Marnen Laibow-Koser wrote:
> pharrington wrote:
> > If your model isn't abstracting the DB in anyway, just don't have it
> > inherent from ActiveRecord::Base...
>
> Exactly.  Also, I recommend that you (the OP, that is) take a look at
> Authlogic, which uses a tableless model for user authentication; perhaps
> it will do what you want.
----
Authlogic too was overkill for my purposes and yes, I didn't need a
ActiveRecord::Base at all, just an indexed hash was all I needed. I just
had to keep it simple.

Thanks

Craig


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
4ab2692ba129cb296d4f2e90ba5241da?d=identicon&s=25 Sandip Ransing (san2821)
on 2009-06-03 09:07
(Received via mailing list)
class ModelName < ActiveRecord::Base

 # Add Following lines in a model
 def self.columns() @columns ||= []; end
  def self.column(name, sql_type = nil, default = nil, null = true)
    columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s,
default, sql_type.to_s, null)
  end

end
On Wed, Jun 3, 2009 at 4:11 AM, Craig White <craigwhite@azapple.com>
wrote:

> Authlogic too was overkill for my purposes and yes, I didn't need a
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> >
>


--
Ruby on Rails, j2ee Developer
http://sandip.sosblog.com

www.joshsoftware.com
This topic is locked and can not be replied to.