Displaying 20 results from an estimated 106 matches for "friendship".
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 my friendship.rb:
class Friendship < ActiveRecord::Base
belongs_to :user
belongs_to :friend, :class_name => ''User'', :foreign...
2008 Jan 07
2
acts_as_state_machine override :initial state
Hello,
I''m not sure if this is where to post this, but i cannot find much
information/support for acts_as_state_machine.
I have a Friendship model which implements acts_as_state_machine. I
have an :initial state of :pending, but i would like to create a
Friendship model and save it directly with :accepted status.
I have tried Friendship.create(:state => "accepted") and Friendship.new,
friendship.state = "accepted&quo...
2010 Feb 16
0
Strange routing(?) Issue
...PUT /users/:user_id/
roles/:id(.:format)
{:action=>"update", :controller=>"roles"}
DELETE /users/:user_id/
roles/:id(.:format)
{:action=>"destroy", :controller=>"roles"}
user_friendships GET /users/:user_id/
friendships(.:format)
{:action=>"index", :controller=>"friendships"}
POST /users/:user_id/
friendships(.:format)
{:action=>"create", :controller=>"friendships"}
new_user_...
2006 May 28
7
Self-referential has_many :through relationship
...end
b = blocked
My models look like this:
class Relationship < ActiveRecord::Base
belongs_to :user
belongs_to :friend, :class_name => ''User'', :foreign_key => ''friend_id''
end
class User < ActiveRecord::Base
has_many :relationships
has_many :friendships, :class_name => ''Relationship'', :foreign_key
=> ''user_id'', :conditions => "relation = ''f''"
has_many :potential_friendships, :class_name => ''Relationship'',
:foreign_key => ''user_id'',...
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 Feb 02
2
ActiveRecord::AssociationTypeMismatch (User(#54754560) expected, got User(#54510280))
i keep getting this AssociationTypeMismatch error. i think this could
be a bug related to ruby/rails when using mixins. heres a short
version of my code:
# user.rb
require ''friend_invitation''
require ''friendship''
class User < ActiveRecord::Base
include FriendInvitationUser, FriendshipUser
...
end
# friendship.rb
...
module FriendshipUser
def self.included(includer)
includer.class_eval do
has_many :friends, :through => :friendship
end
end
# true, if other_user i...
2008 Mar 27
0
Need help in Friendship plugin
I have used salted hash login generator for login system. Now what I
want to do is use Friendship plugin. I have searched for Friendship
plugin tutorial but tutorial use restful authentication login
controller.I am trying to develop demo social networking project. Plz
help me guys how do I integrate Friendship plugin with salted hash
login generator what I am using.
--~--~---------~--~----~----...
2006 Mar 25
0
Self-Referential Many-To-Many relationships where the relationship itself has data.
...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
users have unique names, and friendships have user_id''s, friend_id''s,
and ratings. And here''s the model code:
class User < ActiveRecord::Base
has_and_belongs_to_many :all_friends,
:class_name => "User",
:join_table => "friendships",
:foreign_key => "user_id&qu...
2007 May 10
5
Pagination has many through problems
...at 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
Models
======
class Profile < ActiveRecord::Base
has_many :friendships
has_many :friends,
:through => :friendships
end
class Friendship < ActiveRecord::Base
belongs_to :profile
belongs_to :friend, :class_name => "Profile", :foreign_key =>
"friend_id"
end
When accessing "http://localhost:3000/profiles/list_friends&q...
2008 Nov 20
3
Any progress on undirected self-referential many to many relationships?
I am going to re-ask a question that has been asked a few times in the
past. What is the best way to represent an undirected self-referential
many to many relationship. Trivial examples of this include an edge in
an undirected graph, or a mutual friendship.
Alice is a person
Bob is a person
Alice and Bob are friends of each other
We have a whole bunch of extra information about their friendship
(when it started, who introduced them, where they met, etc.)
We want to query "Are Bob and Alice friends?", "Who are Bob''s
friends?&q...
2009 Jun 14
6
Unable to make observe_field work
I can''t make it work.
<%= text_field_tag :friend %>
<%= observe_field :friend, :url => friendships_url, :on => :click %>
<%= javascript_include_tag :defaults %>
Raises the error:Can''t find variable Form.
The generated html is:
<input id="friend" name="friend" type="text" />
<script type="text/javascript">
//<![CDA...
2007 Jan 05
1
(Enhancement?) for self referential has_many :through, w/ scoped create...
We have a User model and a Connection model which basically represents
edges in a digraph (User to User, self-referenctial). Each of these
edges can have a :connection_type which is currently just a char(1).
has_many :friendships,
:class_name => ''Connection'',
:foreign_key => "source_user_id",
:conditions => "connection_type = ''f''"
has_many :friends,
:through => :friendships,
:source => :tar...
2009 Jul 02
2
working with texts
WinXP, R-2.9.1
LS.,
I have been trying to solve a (for me) tricky issue. No matter what I've
tried, I just can't find a way to do this.
This is the issue:
I have a text file (ansi text) "titles.txt" with lines of text; here is
an example of such a file:
>>>>>
a brief history of polio vaccines
anti-vaccination movements and their interpretations
early warning
2008 Jan 11
5
Missing methods
We have a custom implementation of the Mother Object idea. It''s inside
of a module, basically like this:
module Factory
%w(account friendship person invitation message asset email_address
birth).each do |klass|
eval <<-EOF
def self.create_#{klass}(attributes = {})
default_attributes = valid_#{klass}_attributes
#{klass.camelize}.create! default_attributes.merge(attributes)
end
EOF
end
def valid_message_attributes(...
2008 Mar 20
1
How to get device name with device id?
...ev/sda1, /dev/hda2 etc) in which my file exists.
I've used 'stat' system call to get the device id.
But now I want the device name from this id(st_dev).
How to get that one?
Or
Do you have any other method to know the device name where my file resides?
Thanks
Bollywood, fun, friendship, sports and more. You name it, we have it on http://in.promos.yahoo.com/groups
2016 Feb 15
1
GTX 960M
...Dell XPS 15 laptop, that comes with the subject GPU.
Is this thing usable with nouveau?
--
========================================================================
Ian Pilcher arequipeno at gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================
2017 Mar 13
2
MIPS emulation broken - No PCI buses available
...am still getting this on a fully updated Fedora 25 system
with libvirt-2.2.0-2.fc25.x86_64.
--
========================================================================
Ian Pilcher arequipeno@gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================
2018 May 31
2
Make discard='unmap' the default?
...is it possible to make virtio-scsi the default disk
type, rather than virtio-blk?)
Thanks!
--
========================================================================
Ian Pilcher arequipeno@gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================
2019 Sep 15
1
How to disable i915 module
...being loaded.
Anyone know what might be loading the module and how I can stop it?
TIA!
--
========================================================================
Ian Pilcher arequipeno at gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================
2003 May 09
1
correspondence analysis
Hi everybody, I am starting my friendship with R. Now I want to do a
Correspondence Analysis using the vegan library or multiv library. Both give
me the same results which differ from the ones I get running other programs
like Statistica... I wounder if there is a problem with my matrix. I have
cualitataive variable in the columns and...