Permalink
Browse files

fixing clone/copy action

  • Loading branch information...
mcansky
mcansky committed Feb 7, 2011
1 parent 27d2d90 commit c9dbaafd6373d271b5af798dea581b883281f8e9
Showing with 7 additions and 4 deletions.
  1. +5 −3 app/controllers/posts_controller.rb
  2. +1 −1 app/views/posts/_short_post.haml
  3. +1 −0 config/routes.rb
@@ -140,13 +140,15 @@ def create
return
end
new_b = to_clone.clone
- new_b.link = to_clone.link
- new_b.tags = to_clone.tags
- current_user.bookmarks << new_b
+ new_b.user = current_user
+ new_b.tag_list = to_clone.tag_list
+ new_b.bookmarked_at = Time.now
if new_b.save
current_user.save
logger.info("bookmark for #{new_b.link.url} cloned")
end
+ redirect_to :action => "index", :username => to_clone.user.name
+ return
end
if incomplete || error
flash[:error] = "incomplet"
@@ -10,7 +10,7 @@
= link_to 'e', {:controller => "posts", :action => "edit", :id => post.id}, {:class => "edit", :title => "edit"}
= link_to 'd!', post, {:confirm => "Deleting, You sure ?", :method => :delete, :title => "destroy"}
- elsif (current_user && post.user != current_user)
- = link_to 'c', :controller => "posts", :action => "create", :id => post.id, :method => :post
+ = link_to 'c', {:controller => "posts", :action => "create", :id => post.id}, {:method => :post}
- if post.private?
%span.private P
View
@@ -15,6 +15,7 @@
match 'posts/import', :to => 'posts#import'
match 'posts/import_url', :to => 'posts#import_url', :via => :post
match 'posts/import_file', :to => 'posts#import_file'
+ match 'posts/copy', :to => 'posts#clone'
resources :bookmarks, :controller => "posts"
# tags

0 comments on commit c9dbaaf

Please sign in to comment.