Displaying 20 results from an estimated 300 matches similar to: "Isn't there any performance issue when saving serialized attributes every time?"
2008 Dec 20
9
Upgrade to Rails 2 - problem with "save" (MySQL boolean issue?)
I have been working through an upgrade of my 1.2.6 application to
2.2.2.
I am almost there but I have hit a problem with ActiveRecord.
Before the upgrade, the following code was working fine.
def create_root(administrator)
root = create_root_collection(self.pingee_name,
administrator,
2006 May 28
7
Self-referential has_many :through relationship
Hi,
I have a self-referential has_many :through relationship setup to
track relationships between users. Basically relationships are
modeled as a join table with an extra column ''relation''.
create table relationships (
user_id integer unsigned not null,
friend_id integer unsigned not null,
relation char(1) not null,
)
--- relations ---
f = friend
r = request to
2008 Jun 03
1
Rails 2.1 and default setting of Partial updates
I just updated to 2.1 and created a new, empty project. According to the
docs I''ve seen, including:
http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-partial-updates
The file config/initializers/new_rails_defaults.rb has the default
setting for partial updates and just needs to be edited: "Note: There''s
currently a config/initializers/new_rails_defaults.rb
2006 Jan 27
2
User.already_friend_of(friend)?
I have a User model who HBTM Friends (class User). I would like to check
for the existance of a user in the friends table before actually adding
them (in case they were already added as a friend.)
I have a method called already_friend_of?(friend) defined in my User
model, but I am not sure how to define this method. I simply want to
check to see if one user is already a friend of another user
2006 Mar 31
6
Adding objects to a :through association
So I''m one of those nasty people building a self-referential
habtm-like Association using the funky new :through stuff. This is
about users having friends, so here''s my user.rb:
class User < ActiveRecord::Base
has_many :friendships, :foreign_key => ''user_id''
has_many :friends, :through => :friendships, :source => :friend
end
And here''s
2006 Jan 06
2
Re: Some advice on DB modeling
I have more or less the same problem. I''m trying to build a system where
users can enter their friends. But the solutions seems not to work for me.
I used same sql:
CREATE TABLE `friends` (
`user_id` int(11) NOT NULL default ''0'',
`friend_id` int(11) NOT NULL default ''0'',
KEY `user_id` (`user_id`),
KEY `friend_id` (`friend_id`),
2006 Mar 25
0
Self-Referential Many-To-Many relationships where the relationship itself has data.
Trying to model a bunch of users that have friends that are other
users. clearly a job for has_and_belongs_to_many, but the trick is,
they have ratings for their friends. I have gone through the Rails
Recipes book, and it seems like I''m trying to combine the
self-referential many-to-many recipe (12) and the many to many
relationships where the relationship itself has data recipe (16). So
2006 Aug 15
2
How to access attribute in a self-referential many-to-many relationship
Hello List,
I created a self-referential many-to-many relationship (as described
in the book Rails recipe #18), where I have a model that has
many-to-many relationships with itself. In this case, it''s person who
can become friends. The join table looks like this:
mysql> select * from friends_people;
+-----------+-----------+-----------+
| person_id | friend_id | confirmed |
2009 Apr 01
1
Erro de update no rails 2.3.2
Pessoal, estou precisando de ajuda...
Estou usando o rails 2.3.2.
Quando tento fazer qualquer update (método save em um registro
existente), recebo o erro abaixo:
ArgumentError in RequisicaosController#enviar_rede
wrong number of arguments (3 for 1)
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
base.rb:2875:in `attributes_with_quotes''
2006 May 28
3
Association of table to itself
I''m curious what would be the best way to represent people and whether the
person has someone marked as their friend. Here are my thoughts so far:
People table
- id
- name
Relationships table
- person_id
- friend_id
Now my problem is I don''t know how to set up these associations (if this is
even correct). Friend_id would be an id to someone else from the people
table.
2007 May 10
5
Pagination has many through problems
I have searched for days for an example that demonstrates what i would
like to do, and this morning i thought i''d worked it out, but
no....here''s what i have:
Controller
==========
class ProfilesController < ApplicationController
def friends
current_user.profile.friends
end
def list_friends
@profile_pages, @profiles = paginate( friends, :per_page => 10)
end
end
2006 Jan 28
1
Advice on Optimization, and where to put what?
In my last post I was asking how I could check for the existance of a
record before inserting a new one and this was the helper method that I
was using to do this:
def already_friend_of?(friend)
begin
self.friends.find(friend.id)
true
rescue
false
end
end
I was told that this is not very efficient, as it hits the db every time
I call it. I completely agree and would like to
2008 Oct 21
6
detecting width overflow in serialized column with mysql
So I''ve got an ActiveRecord model pointing to a MySQL db, with an
auto-serialized column ("serialize :columnName").
Thing is, MySQL, depending on how it''s configured (like, by default),
has a bad habit of just truncating your data if it''s too wide for the
column, with no error raised. Yeah, I can probably reconfigure MySQL
and/or my AR connection to it. But
2008 May 15
0
partial_updates feature in rails 2.1, failing to save because of validate_presence _of on other attributes in the table
I am trying to use the new partial_updates feature in rails 2.1,
http://dev.rubyonrails.org/changeset/9157
but it is failing by trying to use all validations in the model
instead of just the changed attributes. The model works as I can
successfully .save(false) but if I try a regular .save I get an error
saying that it could not save because of validations problems. I want
to use this to get
2008 Jul 07
0
ActiveRecord in Rails 2.1.0 misbehaving for Aggregate Attr.
I am not sure if this is a bug in ActiveRecord or is this the intended
behavior. If it is then it does not make sense to me.
In a nutshell: If you change an aggregate object attribute created via
composed_of method (see Agile Web Development - Second Edition Chapter
17 page 313 onwards) and then save the model, the change to the model
(composite attribute specifically) will not be saved UNLESS
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2006 Apr 03
1
has_many :trough with 2x the same table
I have a site where Users can become Friends with other Users. I used to do this with a habtm, but of course I want to stay up-to-date and convert this to a has_many :trough. Unfortunately I can''t get it to work.. the documentation on this feature is a bit sparse at the moment.
This is my old habtm:
has_and_belongs_to_many :friends, :join_table => ''user_friends'',
2008 Jan 23
1
Self-referential HABTM SQL mal-formed when updating record
Guys,
Anyone ever had this kind of problem with ActiveScaffold?
Cheers, Sazima
------------------------------------------------------------------------------------------------
What steps will reproduce the problem?
1. Create self-referential HABTM application (like the common "user
has friends" example)
2. Try to add more than 1 friend to a given user using ActiveScaffold.
What is
2008 Apr 21
7
undefined method `partial_updates='
Hello
When I try the command:
rake db:migrate
I get the following:
rello@calimero:~/Sites/music_library/config$ rake db:migrate
(in /home/rello/Sites/music_library)
rake aborted!
undefined method `partial_updates='' for ActiveRecord::Base:Class
I googled with no results.
Anybody can help me?
Thankyou
--
Posted via http://www.ruby-forum.com/.
2004 Nov 04
3
Promise raid cards
Hello.
I would like to know if promise RAID cards are compatible with CentOS / RHEL
?
I have seen that only SATA is supported on the RHEL hardware compatibility
list. The other ATA raid cards seems not to be compatible. They give source
code and promise grants compatibility with RedHat 8 and 9 but not RHEL.
I would like to know if somebody tried a ATA raid card like Fasttrack
TX2000, SX4000,