When can I find a gem for add “retweet functionality” to my project in ruby on rails 3.1.
e.j. If I have a post and I want the feature, that other people repost my post in his model
Add a example for a user can clone/copy or repost a user’s post:
User 1 have this post:
original = Post.last
=> #<Post _id: 4f2ad6bd1d41c833850000d6, _type: nil, created_at: 2012-02-02 18:32:29 UTC, posted_filename: "240379698830561159_tgw0Xeom_c.png", user_id: BSON::ObjectId('4f2a64511d41c85ae0000002'), board_id: BSON::ObjectId('4f2ab49f1d41c86c2f0000ac'), category_id: BSON::ObjectId('4f1d4dfe1d41c86204000079'), content: "mi ducha">
The User 2 want repost original post and he want catch some attributes and add own attributes. e.j.:
attributes to be captured:
attribs = post.attributes.select {|a| %w(created_at post_filename category_id content).include? a }
post_cloned = Post.new attribs
The User 2 want add his own attributes board_id and user_id and want can update content attribute.
How can the User 2 do it?
Don’t wait for gem. Well, I found an article which is telling how to do it using javascript:
To implement the Retweet button in your application you need to follow the below steps.
Step 1
Add this javascript function within the body of your rails rhtml:
Step 2
Finally add the Tweet button where ever you require in your rails application:
Its acts same as Flike,but a single user can Tweet many times.It means the user can likes the page or the article many times.the count will increment Respectively.
The article will post in your Twitter Account.
Thats it…you will get the Retweet button in your Rails Application.
Hope it helps..
Cheers!