Topic: Tablekit plugin doesnt save my data into DB
I am using Tablekits plugin (Prototype) .. and everything seems work apart from saving data into a table...
Check this out. what i have found about using tablekits on rails...
http://talkingcode.co.uk/2007/12/10/edi and-rails/
At finally, I am not having parameters values on the controller action and having these values on the command prompt when i run submit the value and this "networkerror 403 forbidden http//localhost:3000/editLicence_admin" on my firebug console
Look at this following source code...
Controller
class AdminController < ApplicationController
def updateLicence
@licence = Licence.find(params[:id])
render :text => params.inspect
return
if !@licence
@licence = Licence.new()
@licence.id = params[:id]
end
if !params[:value]
params[:value] = ""
end
#licence.update_attributes(params[:field] => params[:value])
@license.update_attributes({params[:field] => params[:value]})
result = params[:value]
render :text => result
return
end
end
Model: (Licence)
class Licence < ActiveRecord::Base
end
View(LicenceManagement)
<%= javascript_include_tag "tablekit" %>
<%= javascript_include_tag "fastinit" %>
<%= javascript_include_tag "date-en-GB" %>
<script>
TableKit.options.editAjaxURI = '<%= url_for :controller => "admin", :action => "updateLicence" %>';
)%>';
TableKit.Editable.textInput('Licence', {}, undefined, "");
</script>
<link href="/css/tablesorter.css" rel="stylesheet" type="text/css" />
<h2><%=t('admin.licencesManagement.title')%> </h2>
<div class="newlicences">
<%= link_to t('admin.licencesManagement.new'), newLicence_admin_path %>
</div>
<div style="overflow: auto; height: 300px; width: 630px;">
<table class="sortable resizable editable">
<thead>
<tr>
<th id="name"><%= t('admin.licencesManagement.licence')%></th>
<th id="period"><%= t('admin.licencesManagement.period')%></th>
<th id="amount"><%= t('admin.licencesManagement.amount')%></th>
<th class="status" id="status"><%= t('admin.licencesManagement.status')%></th>
<th class="created_at" id="title"><%= t('admin.licencesManagement.created_at')%></th>
<th class="noSortClass" id="show"><%= t('admin.licencesManagement.show')%></th>
<th class="noSortClass" id="author"><%= t('admin.licencesManagement.delete')%></th>
</tr>
</thead>
<tbody>
<% @licences.each do |licences| %>
<tr id="<%= licences.id %>">
<td><%= licences.name if licences.name %></td>
<td><%= licences.period if licences.period %></td>
<td><%= licences.amount %></td>
<td><%= licences.status %></td>
<td><%= licences.created_at %></td>
<td><%= link_to t('admin.licencesManagement.show'), showLicence_admin_path(:licenceId => licences.id) %></td>
<td><%= link_to t('admin.licencesManagement.delete'), deleteLicence_admin_path(:licenceId => licences.id), {:confirm => t('admin.licencesManagement.confirmDelete')} %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
Thanks in advance,