Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed error for duplication of tweet #86

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/ideas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def participate
IdeaUser.by_idea_and_user(current_user.id, @idea.id).first.destroy
else
@idea.users << current_user
User.tweet("@#{current_user.screen_name} is helping out with '#{@idea.title}'. Are you? #{idea_url(@idea)}")
User.tweet("@#{current_user.screen_name} is helping out with '#{@idea.title}' on #{Time.now.strftime ('%d-%m-%Y %I:%M %p')}. Are you? #{idea_url(@idea)}")
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class User < ActiveRecord::Base

def self.tweet(msg)
if Rails.env.production?
twitter.update(msg)
twitter.update(msg) rescue nil
else
puts "TWEET: #{msg}"
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/ideas/_idea.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.grid{class: "idea-box grid-#{idea.id % 4} #{idea.categories.collect(&:name).join(' ')}", id: "idea-#{idea.id}"}
%a{href: idea_path(idea)}
%h2{class: "title"}
= idea.title.truncate(20)
= idea.title.truncate(17)
%i{class: "#{'favorite' if idea.users.include?(current_user)}"}
%h6.categoriesNames
= idea.categories.empty? ? 'No Categories' : idea.categories.limit(2).collect{|c| content_tag(:l, c.name, :style => 'cursor:pointer') }.join(', ').html_safe
Expand Down