daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # controller
  2. def create
  3.   @bookmark = Bookmark.new(params[:bookmark])
  4.   if @bookmark.save
  5.     respond_to do |format|
  6.       format.html do
  7.         flash[:notice] = "Favorit wurde erfolgreich angelegt."
  8.         redirect_to bookmarks_path
  9.       end
  10.       format.js do
  11.         render :update do |page|
  12.           page.insert_html :bottom, 'bookmarks', :partial => 'bookmark'
  13.         end
  14.      
  15.       end
  16.    
  17.     end
  18.   else
  19.     render :action => "new"
  20.   end
  21. end
  22.  
  23. # index
  24. <ul id="bookmarks">
  25. <%= render :partial => 'bookmark' %>
  26. </ul>
  27.  
  28. # partial
  29. <% @bookmarks.each do |bookmark|%>
  30. <li id="bookmark-<%= bookmark.id %>">
  31.   <%= link_to h(bookmark.title), h(bookmark.url) %>
  32.  
  33.     (<%= link_to "Details", bookmark_path(bookmark.id) %>
  34.     <% if admin? %>
  35.      |
  36.     <%= link_to "ändern", edit_bookmark_path(bookmark.id) %> |
  37.     <%= link_to "löschen", bookmark_path(bookmark),
  38.     :method => :delete,
  39.     :confirm => "Wollen Sie diesen Datensatz wirklich löschen?" %>  
  40.     <% end %>
  41.     )
  42. </li>
  43. <% end %>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top