Displaying 3 results from an estimated 3 matches for "edit_item".
2006 May 22
2
good practice or waste of time?
...e that of a logged in user. So far, so good.
Here''s where things (finally) get interesting. When my controller
needs to edit an item, I typically do this:
def find_user
@user = User.find_by_login(session[:user])
end
def find_library
find_user
@library = @user.library
end
def edit_item
find_library
@item = @user.library.items.find(params[:id]) <--- necessary?
# other processing
end
It''s that second line in my #edit_item action that I''m curious about.
It works just fine if I do:
def edit_item
@item = Item.find(params[:id])
# other stuff
end...
2006 Feb 14
2
Inline list editing with RJS: best practices
...ection => @items %>
</ul>
--- _item.rhtml (simplified) ---
<li id="item_<%= item.id %>">
<div id="show_item_<%= item.id %>">
<%= h item.name %>
<%= link_to ''edit'', . %>
</div>
<div id="edit_item_<%= item.id %>" style="display: none"></div>
</li>
I am using RJS templates to populate the ''edit_item'' div on an ajax call
from the ''edit'' link. All very straightforward stuff. The problem is on
update in my RJS template I...
2006 Jan 21
1
Sortable Element with Partials?
Hi Everyone,
I posted this last month and unfortunately, I didn''t recieve any
replies. Maybe this time I''ll have better luck. I originally had my
sortable element list working properly like so:
<ul id="sortable_list">
<% @items.each do |item| %>
<li id="item_<%= item.id %>"><%= image_tag "dragme.gif"