similar to: Access session data from observer

Displaying 20 results from an estimated 10000 matches similar to: "Access session data from observer"

2005 Dec 07
3
ActiveRecord::Observer problem
Hi all, I have a problem with an observer. I have a simple observer... class ActivityObserver < ActiveRecord::Observer observe Customer def after_create(model) bind_params(model) @al.action = "create" @al.save logger "#{model.id} : created" end private def bind_params(model) @al = ActivityLog.new @al.user_id = User.current.id
2006 Feb 21
6
+ camping/session
Camping now comes with a sessioning class, checked in tonight. To get sessions working for your application: 1. require ''camping/session'' 2. include Camping::Session in your application''s toplevel module. 3. In your application''s create method, add a call to Camping::Models::Schema.create_schema 4. Throughout your application, use the @state
2006 Jul 02
11
Rails Plugin: meantime_filter for controllers (actions within blocks)
Hello, I just finished writing a plugin for Rails that I''m annoucing the first release here: meantime_filter. It is descibed at http://roman2k.free.fr/rails/meantime_filter/0.1.0/ rdoc/ (See the end of this message for getting it.) ABOUT THE PLUGIN It extends ActionController to add the functionnality of having filters run at the action call time. This new type of filter yields
2006 Jun 01
0
question about observer callbacks
I''m not sure how to implement this so I''ll describe what I currently have done then what I wish to have happen currently, I have a generic observer for several models class AuditObserver < ActiveRecord::Observer observe Foo, Bar def after_update(model) model.log("UPDATED " + Time.now.strftime("%m-%d-%Y %H:%M")) end def after_create(model)
2006 Apr 21
3
Documenting web services API''s
Sorry to have to post this again - it was probably under the wrong subject and went unnoticed. Is there a standard for providing user documentation for methods that I expose through we services? The default documentation (method names and return types) that appears when the user visits http://localhost:3000/backend/invoke is concise and correct, but a bit terse. How can I give my users a little
2006 Jul 11
0
Access session from observer?
I am writing a logger observer that provides an audit trail for most events that touch my AR models. I am using the acts_as_authenticated plugin for user login. What would be the best way to expose the current user to my observer? I''m not looking to violate MVC here (well, maybe a little -- though a logger seems more like a controller than a model to me). I just want the logger to
2006 Sep 15
2
Caching::Sweeper Access to Controller
Hello, I''m running Mongrel 0.3.13.3, cluster 0.2.0, and Rails 1.1.6 and I have a problem with a sweeper not having access to the controller instance. NoMethodError (undefined method `session'' for nil:NilClass): /app/models/audit_sweeper.rb:16:in `log'' /app/models/audit_sweeper.rb:9:in `after_update''
2006 Jan 15
8
Underscore character in session var
I stumbled across a weird problem i can do: @session[:userid] = 1 but cant: @session[:user_id] = 1 The second session var doesnt set. Is there a config setting for this? -- Posted via http://www.ruby-forum.com/.
2006 Apr 06
7
LoginSystem : make @session available to models
Hello. LoginSystem is cool, it populates the @session instance variable of controllers with many useful info. The fact is : it would be cool to let models know about the session, too. For instance, after_update and after_create callbacks could store *who* did *what* on *what. Aim : having ActiveRecord::Base::session defined, returning the @session of the controller which manipulates the
2006 Mar 15
2
Session (stored in db) not working in testing mode
Hi, I just switched from storing my sessions on disk to storing them in MySQL. Changing environment.rb ''config.action_controller.session_store = :active_record_store''. But now all my tests fail. I get the following error: 1) Failure: test_authorized_new(AdControllerTest) [c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/depr
2006 Apr 26
1
Observer best practices
I''ve seen two ways of connecting observers: 1) In the observer class put observe MyModel 2) In the controller class put observer :my_observer What is the difference between these two? Also, is it necessary to put in the observer class the following? MyObserver.instance Jose -- Posted via http://www.ruby-forum.com/.
2006 Jul 05
1
Securing my database with user session data
I have a few forms that adds information to a database, and one of the fields is "user_id" This field relates the stored information (in this case a "route") with the user who entered it. I have a few questions. First, is the controller the best place to set the user_id? Right now I am using, @route = Route.new @route.user_id = session[:user].id @route.save Should this
2010 Dec 06
1
Loading .RData from Internet
Dear All, Can you please suggest me a correct way to load the following R data frame from the internet and save it to the hard drive? The following is what I tried: > raceprofiling <- > read.table("http://rss.acs.unt.edu/Rdoc/library/twang/data/raceprofiling.RData") > save(raceprofiling, file = 'raceprofiling.RData') However, when I used dim() to check the dataset,
2006 May 24
1
Observer behavior differences between DEV and TEST environments ?
Hi all ! I''m having an issue and I can''t seem to make heads or tails of it. I am attempting to add an observer to a model object. I created app/models/greenback_transaction_observer.rb, inherited from AR::Observer, defined methods, registered in config/environment.rb, but things don''t work... So, I took a step back and put in the following code: class
2010 Dec 31
2
why observer can't fire in rspec? help .
I read the guide and api and i created Observer on model, she can run on rails console of test env. but when i use rspec , the observer can''t run in, it''s never step in. some good man help me, please. i debug it use one day and one night, i can''t sleep in today night unless i solve it. -- You received this message because you are subscribed to the Google Groups
2006 Feb 16
6
session usage
Clearly I have the session and can see that session[:user_id] = 7 Now I want to use the results of this...in a page...so I am trying to use the instance variable @sess_user and at the top of the application controller, I have either... @sess_user = User.find([:first, "id = ?", session[:user_id]) or @sess_user = User.find([:first, "id = ?", session[:user_id]) gives me an
2008 Jul 21
1
Re: Observer
eh, like so? def after_create(model) generate_hotel_param_files(model.id) generate_hotel_setup_files(model.id) end def after_update(model) generate_hotel_param_files(model.id) generate_hotel_setup_files(model.id) end On Jul 21, 9:59 am, David Nguyen <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > Hi, > I have to make an observer if a
2006 May 08
2
session[:user_id] / name problem! Help!
Ok, I have a login on my site, and when I log in, I want to display "Welcome #{user}". In my session, if I do "Welcome <%= session[:user_id] %>" I''ll get "Welcome 1" which is right, but how can I access the name based on the session id? For instance, essentially I want to do this: "Welcome <%= session[:user_name] %>" or
2006 Apr 23
5
Newbie Ajaxy Question
Hi all, I''ve been trying to figure this out by myself and while I feel I''ve made some progress, I feel kind of stuck. Let me see if I can explain what I''m trying to do. I have a very simple form with a text box and a text area. The text in each of these will eventually make it into a row in a table in my database. For now, the value in the text box represents a
2007 Apr 10
15
Wxruby doesn''t work on my Debian sid ( glibc error )
Hi everyone ! i can''t make wxruby work on my debian box, i installed wxruby2preview with the gem command line tool but when i try to run one of the samples, i get this error message : dialogs.rb:1:in `require'': no such file to load -- wxruby (LoadError) from dialogs.rb:1 i searched this mailing list a bit, i tried with the -rubygem argument, i get this error :