I have modified the existing redmine_ezlibrarian plugin for my use but in the plugin when I try to delete any device it asks to delete but when I click on OK it doesn't work.
Also when I click to edit any device the edit form comes but without fetching the data about the particular device id.
I've attached source code for the plugin. Please go through it.
Controller---- def edit_device if request.post? @device.attributes = params[:device] if @device.save flash[:notice] = l(:notice_successful_update) redirect_to :action => 'index', :id => @device, :project_id => @project end end rescue ActiveRecord::StaleObjectError # Optimistic locking exception flash.now[:error] = l(:notice_locking_conflict) end
def destroy_device
if @device.destroy flash[:notice] = l(:notice_successful_delete) else flash[:error] = l(:notice_unsuccessful_save) end redirect_to :action => 'index', :project_id => @project end
List Page- <%= link_to_if_authorized(l(:button_update), {:controller => 'treasures', :action => 'edit_device', :id => @device, :project_id => @project}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %> <%= link_to_if_authorized l(:button_delete), {:controller => 'treasures', :action => 'destroy_device', :id => device.id, :project_id => @project}, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %> Edit Page- <%= labelled_form_for :device, @device, :url => {:action=>'edit_device',:id => @device, :project_id => @project}, :html => {:method => :put,:id => 'device-form'} do |f| %> <%= error_messages_for 'device' %>