The problem is that I have a faux database table simply for the purpose of generating forms (Rails Recipes has a way of doing this from non-AR objects, but I'm currently using SQLite memory dbs). The problem is that to access the form, a user must be logged in, and once they complete the form, I acknowledge that by sending them an email to the address contained in the users table.
I have the choice of manually stuffing information from the session object into the AR object in each controller (there are tons of forms like this), or I can repeat myself a bit less by some clever metaprogramming. Maybe acts_as_* is not the right way to do this, but there just has to be a way to add a couple of accessible attributes to a model without typing in the code each time, right? Thanks On Friday, June 09, 2006, at 9:28 PM, James Adam wrote: >I'm not 100% clear as to what you want this acts_as_* to do. Can you >give a more concrete example? > >- james > >On 9 Jun 2006 20:19:52 -0000, steve ross ><[EMAIL PROTECTED]> wrote: >> I'm using login_engine and would like to create an acts_as_identified >> plugin instead of establishing a has_one/belongs_to relationship (I'm >> using two different databases). Here's how it would work: >> >> class MyModel < ActiveRecord::Base >> acts_as_identified >> end >> >> By the simple addition of this macro, the following things happen: >> >> MyModel acquire new accessors, based on the login information for a >> given user. These read accessors are: >> >> user_id >> full_name >> email >> >> I have a foggy notion of how to create an acts_as_chunky_bacon or >> acts_as_chicken macro, but what I want is something that triggers >> immediately as the class is being built in much the same way >> acts_as_tree does, to add this magic. Additionally, I need to reach out >> and touch the session store from the model (ackkk!) >> >> Any pointers are immensely appreciated! I promise full code, plus some >> extras if I can get this to work :) >> >> Thanks >> -- >> Posted with http://DevLists.com. Sign up and save your mailbox. >> _______________________________________________ >> engine-users mailing list >> [email protected] >> http://lists.rails-engines.org/listinfo.cgi/ >>engine-users-rails-engines.org >> > > >-- >* J * > ~ >_______________________________________________ >engine-users mailing list >[email protected] >http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org -- Posted with http://DevLists.com. Sign up and save your mailbox. _______________________________________________ engine-users mailing list [email protected] http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
