Displaying 20 results from an estimated 10000 matches similar to: "Extension to book login code: list of online users?"
2006 Aug 06
1
Sorting through relationships
Hi,
I''m having a rather annoying problem which can only be explained with
an example, so here we go.
I have a Person class which has_many :assets. An Asset has_one :game.
I would like every Person''s asset to be sorted by its game''s title,
similar to this:
has_many :assets, :order => ''game.title''
That doesn''t seem to work. A
2006 Aug 06
6
Having Problem w/ Agile Web Development book
I get this error ...
NoMethodError in StoreController#index
undefined method `salable_items'' for Product:Class
and here is my store_controller.rb ...
class StoreController < ApplicationController
def index
@products = Product.salable_items
end
def self.salable_items
find(:all, :conditions => "date_available <= now()", :order =>
"date_available
2006 Jun 09
1
Updating Fields In Migration for HABTM Relationship
Earlier I forgot to add updated_at and created_at columns for my
HABTM relationship so I created a migration to add them. In the
migration I also want to go back and set the value of the created_at
and updated_at columns for the previous rows. What is the best way
to do that?
Initially I thought I was being smart and decided to put an UPDATE
SQL query in a find_by_sql statement and
2011 May 06
5
write object array value to csv file
I have an object array @keywords = Keyword.find_by_sql(sql). Now I need
to write all values of @keywords to a csv file, and because the sql
statement is dynamically generated, hence the attribute names are
dynamic too. How can I do it?
Please help!
Thanks!
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on
2008 Mar 07
3
Boolean circles..
Hi,
This is just kindof a RoR question, but since you all potentially do
the same things as I do, I thought I''ll ask here..
Im trying to use the boolean type in the database. Migrations is no
problem, it even converts the 0/1 values from my import CSV to false
and true.
However, I cannot make the :conditions part of a find work:
Loading development environment (Rails 2.0.2)
>> c
2009 Feb 09
2
Counting session days
hi,
I have some session data in a dataframe, where each session is recorded with a start and a stop date. Like this:
session_start session_stop
===================
2009-01-03 2009-01-04
2009-01-01 2009-01-05
2009-01-02 2009-01-09
A session is at least one day long. Now I want a dataframe with 'active sessions' per date. Like this:
date active_sessions
=============
2009-01-01 1
2006 May 23
2
TextMate and Tabs
Hello Everyone ~
Recently I have been moving Rails files between Mac, Linux, and Windows. As
many know the Windows Ruby version 1.8.4 doesn''t like tab characters. I
know in TextMate on the mac you can replace your tabs with spaces from the
Text > Convert menu, but is there a way to set it to do tabs with spaces
instead as you work? The preferences do not seem to have such a
2011 Sep 18
9
Rails 3 and postgresql
I have a simple project created around a very, very simple database: one
main table packs with just three rows
Column | Type |
Modifiers
--------+-----------------------------+----------------------------------------------------
id | integer | not null default
nextval(''packs_id_seq''::regclass)
nombre | character
2005 Aug 07
3
tracking online users
Let''s say I have an application and I want to create an admin program
that will show me who is currently online using the application. I
don''t know the best way to do this. Assuming I am storing my sessions
in the default PStore, I don''t suppose there is any method that lists
all the active sessions, is there?
The only way I can think of to do this is to setup a
2009 Feb 11
6
Sessions do not update created_at column?
Hi All,
I added a column to the sessions table called "created_at" in order to
allow the created time to be recorded.
However, different from other Models, the column does not update
automatically.
Therefore, what codes should I add to update the sessions."created_at"
value?
It is important for avoiding hacker keeping the sessions alive.
Thanks much!
Arthur
--
Posted via
2007 Dec 30
1
restful_authentication plugin + session timeout + single login session?
Hi,
I am using restful authentication plugin
1) I was wondering if there is a way to do a session timeout using the
restful_authentication.
How do I hack it to get the behaviour I need?
2) On top of that, I may need to ensure that a particular user can
only login from a single PC. If the user is already logged in at a PC
and attempts to login from another PC, the session in which he signs
in
2007 May 02
12
2 Rails Applications sharing same login system
Hi i have 2 seperate rails applications. They both share the same login
system.
If someone is logged into application 1 then they should be able to
start using application 2 without logging in again. I am unsure how to
achieve this.
I''ve a feeling i can somehow do it by telling both the apps to share a
cookie, but i''m not sure.
Does anyone know how to do this or has anyone
2006 May 30
4
Help with Shopping Cart example from Agile Web Development 2nd Edition
Hi
I get to about page 103 of the book and get an application error. Further
investigation reveals the following error in the dev log:
Mysql::Error: #42S22Unknown column ''id'' in ''where clause'': UPDATE sessions
SET `data` =
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
trying to set up a "has_and_belongs_to_many" relationship
would very much appreciate the help, not sure what im doing wrong at all.
Scheme.rb
class Scheme < ActiveRecord::Base
validates :schemename, :presence => true
belongs_to :user
has_many :levels, :dependent => :destroy
has_and_belongs_to_many :works
end
Work.rb
class Work < ActiveRecord::Base
2006 Apr 21
5
Simple Question: How to merge SQL results?
Hopefully an easy one, how do I merge two or more SQL query results?
Example:
result1 = find_by_sql(x)
result2 = find_by_sql(y)
What is the best way to merge result1 and result2? I want to be able
to reference the objects as if they were obtained via one query.
Cheers,
Dan
2006 Jul 11
8
Stop updated_at from auto updating?
Hi
Is there any way to temporarily stop the updated_at field from being
updated when a record is modified with ActiveRecord?
I have a date field which is keeping track of when the record data was
last checked by my application and my app manually updates it, of course
when I do this the updated_at field is also touched making it fairly
useless for finding out when the actual data was changed
2001 Nov 17
1
rsync hangs or exists without copying anything
I am trying to mirror a file system using rsync. The command I am using
is of the form:
rsync -a /fs/home/6/ /usr/fs/home/6
/fs/home/6/ is an NFS file system, /usr/fs/home/6 is a local disk.
With versions 2.4.6 and 2.4.7pre1, rsync hangs at random places during
the building file list phase. I tried with and without -v option(s) and
tried breaking the file system down into smaller chunks with no
2005 Oct 28
4
find_by_sql column types
Hello--
There must be a better way to do this. I have a class method in my model
that finds averages and does a few calculations using find_by_sql. The
problem I¹m encountering is that all computed columns from MySQL come back
as type string. E.g.,
def self.find_averages(domain_id)
if @@domain_average
return @@domain_average
else
@@domain_average =
2011 Oct 11
10
Create Two objects at the same time
I have user model and referral model. Referral model has user_id as
field.
Now when a new user is created, I need to call referral#create as well
and pass it the id of the newly generated user to user_id of referral
model. How can I do that.
--
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
2012 Oct 23
7
Not updating the updated_at field
This is for Rails 3.1.1
I have a field called last_seen in a model. This field will be updated
when the something about the record is seen in the real world (don''t
worry about this part)
So I go x.update_attribute(:last_seen, Time.now) and the following happens is
UPDATE "blah" SET "last_seen" = ''2012-10-23 08:57:46.179288'',
"updated_at"