Facebook like user search as you type - ruby-on-rails

I am creating a messaging system for my web app and need help with searching for users to send messages to. So far I have it so that if you type a persons name (who is on the site) you can send a message to them. I want it to be as you start typing a persons name, a drop down appears with users names that the current user is following. Any thoughts on how I can do this?
I am using the gem mailboxer also wondering if anyone has suggestions for a better messaging gem. Thanks in advance.

Use jQuery autocomplete, and just populate the dropdown contents as all users that the user is following... something like current_user.followed_users. It's impossible to give code without seeing how your code works though.

A good alternative to jquery autocomplete is http://loopj.com/jquery-tokeninput/ and github at: https://github.com/loopj/jquery-tokeninput. A facebook like tagging to send message to multiple users. A demo app on https://github.com/railscasts/258-token-fields-revised/tree/master/bookstore-tokeninput-after from Ryan Bates from Railscasts http://railscasts.com/episodes/258-token-fields-revised
Good luck.

Related

dynamic twitter widget id

I want to use the new twitter embedded timelines (https://dev.twitter.com/docs/embedded-timelines) but how can I get the data for the right user by username? I have a lot of websites with users (>500) who have their username in the database but as far as I can see you have to give a data-widget-id to get the tweets from the right user.
Is there any way to do this by username? And if not, how can I quickly convert all my users' data-widget-id to the database?
Any help is appreciated
Looks like the best you can do is get a single valid data-widget-id and use it for many different user names using the data-screen-name property.
There is a discussion here from one of the twitter devs. The same one as #alex_b posted in the comments.
You can wrote same script for PHP, for Rails community this gits could be helpfull to get widget-id dynamically.
https://gist.github.com/shah743/dd042df63a8f307f16ed

Rails Facebook-like Notifications

In my Rails 3 app I have Users, Products, and Likes. If a User posts a Product, and another User Likes this Product, I want that User to get a notification that their Product was Liked.
Is there an existing gem that handles this? I've only come across Pusher but that seems to be overkill.
There are a couple of gems that do that:
RailsActivity
https://www.ruby-toolbox.com/categories/Rails_Activity_Feeds
PublicActivity
http://railscasts.com/episodes/406-public-activity
https://github.com/pokonski/public_activity
I have never used them (although i probably will do it tomorrow ^^) so maybe someone with more experience can give you a better insight given your requirements (or read some part of the documentation)
All the gems that are mentioned above by different people is for implementing activity feed.There is lot of difference between implementing facebook news feed and facebook notification system.
For implementing notification system, I recommend you to check these links.
Gritter
Link
Have you seen this http://railscasts.com/episodes/260-messaging-with-faye ? Faye is used in the example. I'm not sure if you'd still consider it an overkill.

How do I grab meta data from other websites and display on mine in ruby on rails?

When using FB or Google + I can paste a link of any website into the status update box and it will instant load information about that website with the option of flicking through thumbnail images.
How can I go about achieving this in ruby on rails? All my searches seem to bring up php methods on how to do this.
For grabbing video data info I use the Ruby Open Graph Protocol gem. Is there any thing for grabbing data the way FB and G+ do? If not is there a standard way this is done in rails/ruby, if so.. how is this done?
Kind regards
I think you're looking for something like oembed. I've found a gems for that, so I propose you to take look at it: https://github.com/judofyr/ruby-oembed or https://github.com/embedly/embedly-ruby
You should likely use a gem like http://nokogiri.org/
It allows you to work with a html page just as you would do with jQuery. Very handy.

How to implement notification system in RoR?

I finished Ruby on Rails tutorial where I can follow other users and others may follow me like twitter. Now I wonder how to implement notification system if someone starts to follow me, for example, as in stackexchange or facebook in which come and display a notification (eg red 1). How to go about it? Are there any examples of ready solutions you or MVC?
I'd add a before_filter to relevant controller actions that checks for new followers in the database and sets flash[:notice] to something useful like 'X new followers' and links to your followers page. There's a quick overview of how flash works in the docs: http://api.rubyonrails.org/classes/ActionDispatch/Flash.html
Have a look at those 2 railscasts:
http://railscasts.com/episodes/407-activity-feed-from-scratch
http://railscasts.com/episodes/406-public-activity.

rails Gem's the Access the GMAIL, Y! Contact Lists via an API

Anyone know of any solid GEMs that integrate with the GMAIl and Y! Mail APIs to download a user's contacts (emails)?
thanks
You login to gmail using AuthSub mechanism. https://github.com/stuart/google-authsub
Try google contacts using some method as :
http://blog.adsdevshop.com/2008/04/18/import-gmail-contacts-using-ruby-on-rails/
For gmail it's easy: https://rubygems.org/gems/gmail or maybe better for your purpose: https://rubygems.org/gems/gmail_contacts
I'm gonna have another look for yahoo...
EDIT 1:
yahoo is supposed to be part of https://github.com/mislav/contacts but no example given
EDIT 2:
Another way to see the question is to use the opensocial API as mentionned here. It could be a worthy generic solution even if resources are a bit scattered.
Maybe contacts gem: https://github.com/cardmagic/contacts

Resources