Displaying 5 results from an estimated 5 matches for "read_article".
Did you mean:
read_articles
2006 Jan 09
4
Problem with habtm and resulting SQL insert
Cheers,
I have a problem with 1.0 and a habtm relationship between User and Article.
I want to save all articles that users read. I have these models:
class User < ActiveRecord::Base
has_and_belongs_to_many :read_articles, :class_name => "Article",
:join_table => "read_articles"
...
end
class Article < ActiveRecord::Base
has_and_belongs_to_many :readers, :class_name => "User", :join_table
=> "read_articles"
...
end
When I do a
a = User.find(1)
b = Arti...
2006 Jan 02
2
ActiveRecord:
In the Agile Rails book, on page 232 (PDF, 4th edition) there is an
example of (within ActiveRecord) marking an article as read by a user at
the present time. Short example code (from the book) here:
class User < ActiveRecord::Base
has_and_belongs_to_many :articles
def read_article(article)
articles.push_with_attributes(article, :read_at => Time.now)
end
# ...
end
However, it seems this piece of code would only work the first time you
read a specific article. It appears to always create a new join table
post, and not to just update if there is an existing p...
2006 Jan 02
1
ActiveRecord, << or push_with_attributes: update if exists?
In the Agile Rails book, on page 232 (PDF, 4th edition) there is an
example of (within ActiveRecord) marking an article as read by a user at
the present time. Short example code (from the book) here:
class User < ActiveRecord::Base
has_and_belongs_to_many :articles
def read_article(article)
articles.push_with_attributes(article, :read_at => Time.now)
end
# ...
end
However, it seems this piece of code would only work the first time you
read a specific article. It appears to always create a new join table
post, and not to just update if there is an existing p...
2006 Feb 21
7
Self-referencial habtm relationship
Heyo!
I am setting up a self-referencial habtm relationship with the users
of my app. I am using Chad Fowler''s "Rails Recipes" to get me started,
and everything works great with the join table "people_friends". I add
friends by doing somebody.friends << somebodyelse. However, with my
app, there is an approval process so my join table has columns
person_id,
2010 May 03
0
TCP Tuning/Apache question (possibly OT)
...I've been requested to add some TCP tuning parameters to some CentOS
5.4 systems. These tunings are for the TCP receive buffer windows:
net.core.rmem_max
net.core.wmem_max
Information on this tuning is broadly available:
http://fasterdata.es.net/TCP-tuning/linux.html
http://www.speedguide.net/read_articles.php?id=121
Potential downsides are available:
http://www.29west.com/docs/THPM/udp-buffer-sizing.html
>From the above, the rmem size is a function of the number of listening
processes times the size of the receive buffer.
Apache can initially create a bunch of server processes (StartServers
d...