Ahoy, I have a location object that looks something like this when using <%= debug @location %> --- !ruby/object:Location attributes: title: The Studio id: "3" zip_id: "40915" address: 9013 Main Street I want to add a another method, "godzilla" --- !ruby/object:Location attributes: title: The Studio id: "3" zip_id: "40915" address: 9013 Main Street godzilla: "raaaaaaaa" How do i do this? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
In your "location" model, attr_accessor :godzilla Is that what you''re asking? Jason On Dec 11, 8:08 pm, will <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ahoy, > > I have a location object that looks something like this when using > <%= debug @location %> > > --- !ruby/object:Location > attributes: > title: The Studio > id: "3" > zip_id: "40915" > address: 9013 Main Street > > I want to add a another method, "godzilla" > > --- !ruby/object:Location > attributes: > title: The Studio > id: "3" > zip_id: "40915" > address: 9013 Main Street > godzilla: "raaaaaaaa" > > How do i do this? > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jason, Then :godzilla is nil by default. attr_accessor :godzilla allows me to do in the controller @godzilla = "asdf" then location.godzilla will return "asdf" but how do i set that as a default in the model?> In your "location" model, > > attr_accessor :godzilla > > Is that what you''re asking? > > Jason-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hello, I store sessions in my database and I''d like to store a session_id with a user when they log in. How do I determine what a user''s session id is? The reason I want to do this is because I''d like to display users currently logged in. If I can link a session to a user in my database, then I can check the updated_at column in the sessions table and determine who is active. Is this the correct way to go about doing this? thanks in advance, Chris. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chris H wrote:> > Hello, > > I store sessions in my database and I''d like to store a session_id > with a user when they log in. How do I determine what a user''s session > id is? >session.session_id> The reason I want to do this is because I''d like to display users > currently logged in. >session.session_id won''t help here as it applies to the current user only.> If I can link a session to a user in my database, then I can check the > updated_at column > in the sessions table and determine who is active. > > Is this the correct way to go about doing this? >There was a similar discussion about this previously. Basically you already have access to the user session in the AR Store. You just need a way to differentiate a user session from anonymous ones, if you have both session types. It might be possible to add a user_id column to the AR Store table and populate the column when a user logs in. Alternatively, record users in a separate user_table. You will have more flexibility in storing and managing user info with this approach. HTH, Long www.edgesoft.ca/blog/read/2 - rails articles --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Chris, Chris H wrote:> How do I determine what a user''s session id is? > > If I can link a session to a user in my database, then > I can check the updated_at column in the sessions > table and determine who is active.session[:id] will give you the id of the current session, but I don''t think that''s what you''ll end up wanting. hth, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
take a look at this for some info: http://habtm.com/articles/2005/12/15/whos-online On 12/12/06, Bill Walton <bill.walton-xwVYE8SWAR3R7s880joybQ@public.gmane.org> wrote:> > > Hi Chris, > > Chris H wrote: > > How do I determine what a user''s session id is? > > > > If I can link a session to a user in my database, then > > I can check the updated_at column in the sessions > > table and determine who is active. > > session[:id] will give you the id of the current session, but I don''t think > that''s what you''ll end up wanting. > > hth, > Bill > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---