Displaying 20 results from an estimated 15451 matches for "friends".
2007 Jan 20
2
Conditional pluralize without the number
Hi.
Assume you have an array of person names. I want to generate results in
my view that look like this:
Abby is your friend
or
Abby, Bob, and Carol are your friends.
So I''d like to say:
<%= friends.to_sentence %>
<%= pluralize(friends.count, "is") %>
your <%= pluralize(friends.count, "friend") %>
But because pluralize puts in the number, I get:
Abby 1 is your 1 friend
or
Abby, Bob, and Carol 3 ar...
2010 Feb 13
3
extension not found
hi friend need ur help in dial plan, i want to allow exten 2000 to 2005 can make call outside and exten 2006 to 2010 can not make call outside. heres my dial plan.
?
sip.conf
?
[general]
port = 5060
bindaddr = 0.0.0.0
context = others
[2000]
type=friend
context=outside
secret=1234
host=dynamic
[2001]
type=friend
context=outside
secret=1234
host=dynamic
[2002]
type=friend
context=outside
2006 Feb 25
0
self referential habtm using join tables
...ationships Where the Relationship Itself has Data".
So far I have had little luck. Here is what I have that works a
little, but not really:
Migrations:
create_table "users" do |t|
t.column "name", :string
t.column "email", :string
end
create_table "friends" do |t|
t.column "user_id", :integer
t.column "acquaintance_id", :integer
t.column "approved", :integer
end
Models:
class Friend < ActiveRecord::Base
belongs_to :users
belongs_to :friends
end
class User < ActiveRecord::Base
has_man...
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...
2006 Feb 27
0
self-referential many-to-many using a join model
...Relationships Where the Relationship Itself has Data".
So far I have had little luck. Here is what I have that works a
little, but not really:
Migrations:
create_table "users" do |t|
t.column "name", :string
t.column "email", :string
end
create_table "friends" do |t|
t.column "user_id", :integer
t.column "acquaintance_id", :integer
t.column "approved", :integer
end
Models:
class Friend < ActiveRecord::Base
belongs_to :users
belongs_to :friends
end
class User < ActiveRecord::Base
has_many :fri...
2011 Sep 19
7
how to get instance variables in another action in rails 3
In my controller show method i have two instance variables which have
large amount of data and take much time to fetch from remote system.
shown below
def show
@graph = Koala::Facebook::GraphAPI.new(session[:fbuser]
["credentials"]["token"])
@friends = @graph.get_connections("me", "friends")
@friends =@friends.to_a
end
in the same controller I have another action which requires same data.
shown below
def list
@graph ||= Koala::Facebook::GraphAPI.new(session[:fbuser]
["credentials"]["token"])...
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...
2006 Feb 13
5
Acts_as_taggable pluralize
I am implementing a messaging system, which requires broadcast to group
feature.
Instead of a relatively clunky habtm group structure, I am using tags.
Form a usability standpoint, it would be helpful to avoid redundant
tags. Like, friend vs friends OR client vs. clients.
Is it practical to filter tags, before entry, to avoid duplicate tags
like plural vs. singular?
--
Posted via http://www.ruby-forum.com/.
2011 Apr 20
1
add brick unsuccessful
Hi again,
I'm having trouble testing the add-brick feature. I'm using a
replicate 2 setup with currently 2 nodes in and am
trying to add 2 more. The command blocks for a bit until i get an "Add
Brick unsuccessful" message.
According to etc-glusterfs-glusterd.vol.log below i can't seem to find
anything :
[2011-04-20 12:55:06.944593] I
2009 May 04
1
Syncronization in rails
Hello,
Here is the logic that I am trying to achieve. I have a User Model and
the business rule is that user can accept maximum 5 friends requests.
for this I have an accept method in User Model which looks similar to
below code snippet
def accept(friend)
raise ArgumentError if self.friends.count >= MAX_FRIENDS_ALLOWED
...
...
#code to add friend to friends list
end
As you can see that I basically query for count...
2008 Jan 24
12
getting started with facebooker
...)
3.) created a method on controller & view to handle initial request
4.) added "ensure_application_is_installed_by_facebook_user" to top
off application.rb
I am able to get to my landing page and show the facebook id of the
users that comes in, but...
If I try to show the users friends in the view using:
<% for a_friend in @user.friends %>
<%=a_friend.first_name%>
<% end %>
It makes my server hang, for about 70 seconds, then the method seems
to complete. Note, I had similar functionality working in rfacebook,
so I don''t think its an environmen...
2006 Jun 26
2
How can I minimize SQL queries
I have users, who have friends that are also users in mysql database.
I have a foreign key for both users, so that I can reference their data
directly. My problem is displaying friends. My for statement would
look something like this:
for i in(0..@user.friends.length)
puts @user.friends[i].user.name
end
so @user is the u...
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 14
8
How search engine friendly are RoR sites?
I am a total RoR virgin, and took my first steps this weekend into the
Ruby world. A lot of sites I create need to be as SEO friendly as
possible, particularly for google. Before I delve any further, can
anyone tell me how friendly the dynamic URLs or if there is the usual
rewrite mod for rugby?
Thanks
Mike
--
Posted via http://www.ruby-forum.com/.
2008 Mar 18
0
Merge Facebook friends with app friends
I have an attribute on my user model called friends, is it possible to
merge the session[:facebook_session].user.friends_with_this_app with
the friends attribute? Optimally I could call @user.friends and it
would return the standalone app''s friends and the Facebook friends who
have the app.
2008 May 06
1
check_friendship method only returning value of last pair
...I am
having is due to my misunderstanding or a bug in facebooker plugin.
Here is what I have:
def show
@current_user ||= facebook_session.user
@member ||= params[:id].to_s==@current_user.id.to_s ?
@current_user : Facebooker::User.new(params[:id])
#for each of current_user''s friends, check if they are friends
with the member and return an array of only the mutual friends
@mutual_friends = [] #initializing array to store mutual friends
#create an array in the format of
[[friend1ID,memberID],[friend2ID,memberID]...]
@friends_array = @current_user.friends.map {|frien...
2012 Mar 28
1
parallel bash scripts
Check out the redirection at the end of each command. 1>&2 redirects
the standard out of your child command to the standard error which then
appears in the parent shell. At the end the last & launches your
command into a background shell and then moves on to launch the next
command. The redirections don't care if the command ever terminates.
The result is that both commands
2006 Jan 02
3
Altering the accessor of an association collection
I want to be able to do something like this (for example):
class Person < ActiveRecord::Base
has_many :friends
def friends(living_in = :uk)
# filter based on parameters here
end
end
Is there any way I can redefine the accessor for an association whilst
still being able to get the values? Basically, I''m looking for an
equivilent of read_attribute() for associations.
--
Posted via http:...
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`),
CONSTRAINT `fr...
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
Models
======
class Profile < ActiveRecord::Base
has_many :friendships
has_many :friends,
:through => :friendships
end
class Friendship < Ac...