Must it be a plugin? Ive done something similar with a little code on my own: var fileList = []; fileList.push({fileName: "somefile1", fileExt: ".jpg", fileSize: 128000}); fileList.push({fileName: "somefile2", fileExt: ".DOC", fileSize: 158930}); fileList.push({fileName: "somefile3", fileExt: ".xml", fileSize: 3695200}); CreateTable(fileList); function CreateTable(fileList) { $("#fileList tbody").empty(); for (var n = 0; n...
If the database is too heavy , and read-only, then I would suggest you upgrade your database and launch it as a new version of your application, so when the user updates the app from the appstore, the previous db woud be deleted and the new one will be installed,...
javascript,angularjs,crud,angular-services
After you've created the object you can push the object to the list or call getAll $scope.createItem = function (newObj) { CrudService.create(newObj); $scope.newObj = null; $scope.ok(); \\either $scope.nameslist = CrudService.getAll(); \\or $scope.nameslist.push(newObj); // this assumes this is an array } UPDATE/// $broadcast sends messages down to child controllers whereas $emit...
ruby-on-rails,ruby,ruby-on-rails-4,activerecord,crud
I would provide a dropdown instead with the tools available. Something like: <%= f.collection_select(:tool_id, Tool.all, :id, :name) %> If the list of tools is large you might be better off with autocomplete, but that depends on your application....
ruby-on-rails,ruby-on-rails-3,crud
When you specify in routes resources :subjects It creates seven actions( index, new, create, create, show, edit, update, destroy) When you call localhost:3000/subjects it ask routes where to go. And index action is called /subjects subjects#index display a list of all subjects And when you are saying localhost:3000/subjects/list It expect...
java,database,crud,automatic-storage,mangodb
No,it wont automatically store date and time for each CRUD operations, we need to manually do this.
java,mysql,playframework,playframework-2.0,crud
Well with Java I'd recommend Ebean's SqlQuery API for doing this (maybe because I just prefer it ;)). In project/plugins.sbt uncomment the line (last one): addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0") In built.sbt modify line and add the PlayEbean to enabled plugins, like: lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)...
I would go for another update function, let's say updateStatus in your UserController. You will use a specific validator within this function. If you have in your User Model some validation rules like this: public static $rulesUpdate = [ 'name' => 'required', 'lastname' => 'required', 'status' => 'required', ]; I...
The task field of User contains the tasks as embedded subdocs, not references to another collection, so you can't query tasks independent of users (like you're trying to do). To query for the embedded task subdoc, you can use a query like this: User.findOne({'task._id': req.params.id}) .select('task.$') // Just include the...
An answer of a general nature can give you a first address. What you ask is very well-organized and managed just by the framework itself. For all these things the Yii2 provides all the elements to be used. The only problem is that all these elements are many and it...
Try not to alter the form this way. You can easily generate the action URL in controller and pass it as a form option to your form type. In buildForm() method, use the $options array and set the action from that option. You can also define form method in the...
This: <?= $form->field($model->baseTable, 'description')->textInput() ?> should work since baseTable is correct relation name. The related record simply doesn't exist (it's null as you can see from error). It can be either error related with incorrect filling of previous relations or relation is optional. In the latter case you need to...
sharepoint,sharepoint-2013,crud,site-column
This is doing exactly what you need, I've done it for work as well couple of weeks ago. var ctx; var web; var fieldChoice; var fieldName; var values; $(function () { SP.SOD.executeOrDelayUntilScriptLoaded(Function.createDelegate(this, function () { fieldName = $('#dropdown').find(":selected").text(); populateValues(fieldName); }), 'SP.js'); }); function selection() { fieldName = $('#dropdown').find(":selected").text(); populateValues(fieldName); }...
Moments ago I just managed to make it work: I was looking through the CRUD's code properties in the adjacent "Properties" tab in NetBeans when this caught my eye: under "code generation" there was a property called "Variable modifiers" which was set to "private". After setting it to "public" it...
spring,authentication,spring-security,crud
Simple. Authentication auth = SecurityContextHolder.getContext().getAuthentication(); String username = auth.getName(); Object credentials = auth.getCredentials(); To access the credentials, i.e. the password, you need to set erase-credentials to false: <security:authentication-manager erase-credentials="false"> ... </security:authentication-manager> ...
I create Ilaro.Admin and it is exactly what you looking for, but please keep in mind there are a lot of stuff to do.
First, here is a working sample of your code: public function offerweekchangeAction(Request $request, $offerid) { if ($offerid) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('AlexanderBuerkleShopBundle:Promotion')->findOneBy(array('id' => $offerid)); $form = $this->createForm(new OfferWeekChangeType(), $entity); $form->handleRequest($request); # \Doctrine\Common\Util\Debug::dump($request->getMethod()); if ($form->isValid()) { $em->persist($entity); $em->flush(); return...
Why not just loading each controller at startup passing to each controller the router object: Use this module to load each controller at startup: module.exports = function(router) { var fs = require('fs'); // Setup controllers var controllers = fs.readdirSync(__dirname + '/controllers'); // <-- use your controllers path controllers.forEach(function(controllerName){ var module...
Consider the following code $user = $entityManager->find('User', 1); $products = array(); foreach(array(1, 3, 4) as $product_id) { $products[$product_id] = $entityManager->getReference('MyBundle\Entity\Product', $product_id); } $user->setProducts($products); $entityManager->persist($user); $entityManager->flush(); And setProducts defined as function setProducts($products) { $this->products = new ArrayCollection($products); } In this case doctrine will delete all the user's product associations and then...
android,android-asynctask,android-contentprovider,crud,loader
You can use an AsyncQueryHandler. Pretty much exactly what you've done using AsyncTask, but all the heavy lifting is already dealt with. Assuming your Content Provider is all good, basically all you really need to do is (for an update): AsyncQueryHandler handler = new AsyncQueryHandler(ctx.getContentResolver()); final ContentValues cv = new...
Probably your url is wrong. You do not need to specify the sufix Controller on your class and the best way to get the right url according the route tables is using the Url property in the View. Anoth point is your async request (delete action method) returns a redirect...
We don't have .destroy_all yet. Its on my short list, but I'm reworking one thing in the data provider API to make it a bit smarter. For now you can do store.patients.reverse.each(&:destroy) (The .reverse is needed since your deleting array objects as you loop)...
Generating CRUD controllers in a bundle different of the entity's one is, as far as I know, impossible. Indeed, CRUD controllers generator is just here for test. But if you really want to use it, you can actually copy the controller, views and form in the other bundle. You'll just...
I think you could : Create a model who return all players Create a form with a checkbox list example : <?php foreach ($players as $player) : ?> <input type="checkbox" name="players[]" value="<?= $player->id ?>" > <?= $player->name ?> </input> <?php endforeach; ?> I tried this in a php file if...
php,postgresql,methods,yii,crud
When you want to delete a record you must fetch it like below: $model = Crud::find($id)->one(); So: $model = Crud::find($id)->one()->delete(); Or you may use this: protected function findModel($id) { if (($model = Crud::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); }...
If you want to delete any products that have the same category, I would change your category class that extends eloquent to something like this: class Category extends Eloquent { // ... all your existing code... public function delete() { // Delete all of the products that have the same...
asp.net-mvc,logging,log4net,crud,tracking
Finally I found Bilal Fazlani's perfect article "Adding Log Feature to Entity Framework" and that is really very easy to integrate to the project. Anyone who need to log/audit in Entity Framework by using Code First approach easily apply it to their own project. Thanks a lot for your help...
android,google-app-engine,rest,crud
Google Cloud Endpoints use the API-Explorer system. /_ah/api is defined for the API Explorer, you can't change it. notesEndpoint is the name of your Api, and v1 the version you define. notesdata is the name of the method. You can override the path by annotation. Example, to access to the...
What happens in your first code snippet is not an update of a by-reference object, it is an update of a reference to an object, while the object itself remains unchanged. Here is what happens: First line gets MyEntity object from the context. Second line replaces the reference to that...
If you are using API are pure rest then you can use ngResource or Restangular and if not then better to use services for that.Below is the link why we should thin slice controller and have more business logic in services or factory http://toddmotto.com/rethinking-angular-js-controllers/...
The first operation is an example of a JPQL 'bulk' operation and while more efficient in terms of number of SQL statements executed, you should be aware of the following important points: https://docs.oracle.com/html/E24396_01/ejb3_langref.html#ejb3_langref_bulk_ops 10.2.9. JPQL Bulk Update and Delete Operations Bulk update and delete operations apply to entities of a...
Slick's def column[T] requests an implicit TypedType[T] in its signature. Slick ships with TypedTypes for Int, Double, Date, etc., but it can't find any one for the generic type I. You can request one in the constructor to FkTable. Just add a second argument list to FkTable as (implicit tt:...
yahooo... I have done Just Look at My Code <?php $connection = mysql_connect("localhost", "root", ""); // Establishing Connection with Server $db = mysql_select_db("pacra1", $connection); // Selecting Database from Server if(isset($_POST['submit'])){ // Fetching variables of the form which travels in URL $file_name = $_POST['file_name']; $ref_no = $_POST['ref_no']; $to_name = $_POST['to_name']; $confidential...
This is how I do it: public function search($params) { .............................. if($this->keyword) { if(preg_match("/[A-Za-z]+/", $this->keyword) == true) { $query->andFilterWhere(['like', 'LOWER(CONCAT(name, age, WHATEVERFIELDS)), ', strtolower($this->keyword)]); } else { $query->andFilterWhere(['id' => $this->keyword]); } } keyword is not actually a column in the db it is just a variable I attached to the...
c#,.net,entity-framework,stored-procedures,crud
It is indeed possible to use Migrations with a Code First Database to generate stored procedures for CRUD operations in Entity Framework 6 and beyond. Note that this is not possible in this manner with Entity Framework 5 and earlier, though you could still use raw SQL calls. Define your...
codeigniter,codeigniter-2,crud,grocery-crud
I guess this happens in the flexgrid theme (the default theme of grocery). To achieve this you will to change the default theme of grocery in order to use twitter bootstrap or datatables theme. You will use a function called set_theme for that. Here is a code sample of how...
Just include both the drivers, that's totally ok. As long as you only load one there definitely won't be any problems. You may implement a simple detection of the databases at their standard paths / check if it is already running on the default port. If there's only one...
javascript,ajax,asp.net-mvc,entity-framework,crud
Your success callback is invoked after the request to the server has already been sent and the record already deleted. You need to confirm the user intention before you're performing the Ajax request, typically using the window.confirm method. Something like: $('table.dataList tbody a[linktype="Delete"]').click(function (e) { if (!window.confirm("Are you sure you...
Essentially the button click should use ng-click to execute a function and pass the item to that function. Example: ...ng-repeat="item in items"... <button type="button" ng-click="updateItem(item)">Update</button ... Then in the function you have the exact item that you want to update. If you are using $resources, it would be something like:...
php,mysql,codeigniter,codeigniter-2,crud
here is the wrong you call wrong model file $this->load->model('inventory_model'); it should be $this->load->model('crud_model'); and you use wrong way to pass array in function $param = array('id_exp_detail' => $id_exp_detail, 'name' => $post_array['brand'], 'quantity' => $post_array['item_quantity'], 'lote' => $post_array['package_code'], 'type' => $type, 'date' => date(), 'id_user' => $this->session->userdata('id_user'), 'id_entity' => $this->session->userdata('id_entity'));...
If i understood correctly you do like this with the help of CTE with cte as ( update mytable set val1 = 'Foo' where val13=1234 and val12=12 returning * ) select * from cte where val14=(select max(val14) from mytable ) ...
Here is a simple way. You can have multiple submit buttons. Like <input type="submit" name="submit" value="Edit" /> <input type="submit" name="submit" value="Make a copy" /> When this forms get submitted, you can check which submit button was pressed by asserting with $_POST['submit'] or $_GET['submit'] if you method is GET. For example:...
I would recommend the Spring Framework with the Spring Data JPA project. http://projects.spring.io/spring-data-jpa/ You can annotate any JavaBean with the correct JPA annotations. Then create an interface which extends the Spring CrudRepository. Some configuration and add the Hibernate or EclipseLink dependencies. Ready! http://docs.oracle.com/javaee/6/tutorial/doc/bnbpz.html A good tutorial: http://spring.io/guides/gs/accessing-data-jpa...
Strong parameters Rails sends form parameters in nested hashes. { page: { subject_id: 1, name: 'Hello World.' } } So to whitelist the parameters you would do. class PagesController < ApplicationController def index @test = Page.all end def new @test = Page.new end def create @test = Page.new(page_params) if @test.save...
php,codeigniter,callback,crud,grocery-crud
If you are using PHP version >= 5.3 then it is much better to use anonymous functions instead. It is much better as it always works, you don't have to search to find the function, it is much more readable and you don't have to use just a fake name...
<%= render 'form' %> Renders the 'form' partial, which can be found in the same folder, named as _form.html.erb. Edit that file to add the new fields. You can read more about Rails partials and layouts here....
class,servlets,crud,maintenance
in case you are faced with the same problem, we suggest you to use the FULL URL OF THE SERVLET(S) IN YOUR JAVASCRIPT(S). I don't know how and why the servlet context gets dizzy when use /prj/sevlet format. this has solved our problem.
php,symfony2,twitter-bootstrap-3,crud,symfony-2.3
I used to have to perform my own form modifications as well. However, Symfony 2.6 introduces support for Bootstrap 3.0 for forms: http://symfony.com/blog/new-in-symfony-2-6-bootstrap-form-theme So if you upgrade to Symfony 2.6 you should have that built in....
ruby-on-rails,activerecord,crud,form-for,nesting
Change your ListsController new and create actions to the following: def new @collection = Collection.find(params[:collection_id]) end def create @collection = Collection.find(params[:collection_id]) @list = @collection.lists.build(params[:list]) if @list.save redirect_to root_path(@user) else render 'new' end end ...
node.js,mongodb,mongoose,mongoid,crud
Quote from SERVER-2016: The argument to $pull is already applied to each element of the target array, so using $elemMatch is redundant in the update context. So just execute your query without $elemMatch: User .findByIdAndUpdate(req.user._id, { $pull: {events: { _id: _eventId //_eventId is string representation of event ID }} },...
New response : According to the documentation : It tells Twig to remove spaces between {% block body -%} and next HTML tag. Example : {% block body -%} <p>...</p> {% endblock %} </div> will output : <p>...</p> </div> Spaces between block Twig tag and p HTML tag are removed....
rest,crud,restrictions,couchbase-sync-gateway
I think this is a good use case for using the role api available in the sync function. For example, the admin user would have the admin role. You can assign a role to a user with the role function. Then both the normal and admin user have access to...
You dont need to use getData or setData on the form, you should use the setter of the entity itself. What you will save/persist is not the form, its the entity. The form is also using the setters on the entity class for the data which was sent. like: public...
Okay, I've managed it myself. Only make a EJB Injection and use the Facade. Example here with "Personenstamm" (same as "Kandidatenstamm" in principle) @EJB private PersonenstammFacade personenstammFacade; .... List <Personenstamm> personlist; personlist = personenstammFacade.findAll(); .... //do what you want with this list ...
The atomic piece of information in MarkLogic is the document. A document is identified by a URI (this is its global, unique name in the database). There are many ways to read, create, update and delete documents. But in a nutshell, they all boil down to the following functions: create:...
ruby-on-rails,database,ruby-on-rails-4,crud
Ultimately I solved it with the following: (seemed most efficient) @officer_id=company.roles.where(role_string: "President").first.officer_id @officer=company.officers.find(@officer_id) The reason for the first.officer_id was that only one officer/company is allowed to have a given role, even though an officer has many roles. There's probably a more elegant way to do this but the above works...
I end up have path like blog/[blog_id]/tag/[tag_id]/suggest which go to dedicate controller SuggestionController where I define suggest action there.
One word answer is NO. Slightly longer answer is: HBase does not process unneeded families during scanning at all. Every family is actually stored into different storage so it is obvious there is no need to search something into not specified family. If no family is specified, all families are...
java,hibernate,spring-mvc,crud
As per your comment,i think you can define relationship between these two entities like below. @Entity @Table(name="employee") class Employee{ @Id @GeneratedValue private Integer id; @ManyToOne @JoinColumn(name = "job_name") private Job job; // other column and getter and setter } @Entity @Table(name="job") class Job{ @Id @GeneratedValue private Integer id; @Column(name="job_name") private...
javascript,twitter-bootstrap,crud,reactjs
You can use React-Bootstrap (http://react-bootstrap.github.io/components.html). There is an example for modals at that link. Once you have loaded react-bootstrap, the modal component can be used as a react component: var Modal = ReactBootstrap.Modal; can then be used as a react component as <Modal/>....
php,symfony2,doctrine2,crud,symfony-forms
This is the normal behaviour of the DoctrineCrudGenerator, because the generator uses only the Doctrine\ORM\Mapping\ClassMetadataInfo::$fieldMappings array to generate the table, but the ParentAlbum-ManyToOne association is located in the Doctrine\ORM\Mapping\ClassMetadataInfo::$associationMappings array. So it never will be recognized on crud generation. To demonstrate a possible solution I use the the Comment entity...
Everything was OK, but the case of autoSync Ext.define('Chronos.store.manage.Clients', { ... autoSync : true, Sorry...
Let me preface by saying I am pretty new to angular. With that said, you can create a CustomerClass that is used in the CustomerList and Customer services. The customerlist service will return an array, whereas the customer service will return a single customer. Even though I add them to...
javascript,html,twitter-bootstrap,backbone.js,crud
From looking at your Fiddle and fixing its dependency issues, there are a couple problems: Your Add button has no idea what modal its attribute is referring to, since the modal exists as a Backbone View with a template, and is not in the DOM. Your Add modal has no...
ruby-on-rails,ruby-on-rails-4,associations,crud,nested-forms
I think you can use some callbacks in your Article model for solve your 2nd problem, Start deleting this, try to keep your controller as simple as possible and handle the operations in your models. @receipt.articles.each do |article| warranty_time = article.warranty_time article.warranty_expires = @receipt.shopping_date.advance(months: warranty_time) end In your Article Model...
In your controller add something like this: private def skill_params params.require(:skill).permit(:attribute_1, :attribute_2, :attribute_3) end then change create to: def create @skills = Skill.new(skill_params) if @skills.save redirect_to :action => 'index' else @skills = Skill.find(:all) render :action => 'new' end end This is specific to Rails 4: this version of ruby on...
It's hard to know without seeing your JS, but it's probably because your loop is outputting a row for the "success" part. I'd suggest doing this: $array= array( "success" => "true", "data" => array() ); while($q = $conMy->nextOcorrencia($busca)) { $array['data'][] = array( "codigo" => $q['codigo'], "codusuario" => $q['codusuario'], .... Then...
controller,asp.net-mvc-5,crud,dbcontext,dbset
You don't need to use different instances of DBContext in your controller for accessing different DBSets. (Best practice is to use the same instance during the duration of the request, which might access one or more DBSets. This can be accomplished by dependency injection or other means, such as your...
Add to your bookmarks these 2 resources: JSF by by Bauke Scholtz JSF 2.2 tutorial with Eclipse and WildFly All you will need you will find there. Try to make a simple Hello World JSF application and then begin to add functionality. When you will meet an issue (concrete problem)...
<my_view_name> this is a terrible way of looking at this. Read about MVC. You are creating controllers, routes are to controllers not to views. Stop looking if the views are there... look if the controller is there. You never interact with a view, you always do with a controller. So,...
Create new method inside of your related model and call with $data <?= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], ..... # below $data is current Model initial ['label' => 'Count', 'format' => 'html', 'value' => function($data){return $data::getCreatedStaticFuntion($data->product_id);} ], # or use like below...
To check if any of the object's attributes are nil, you can do @object.attributes.values.include?(nil) or @object.attributes.values.any? &:nil? ...
c#,sql-server,crud,temp-tables,petapoco
Even if you can (I haven't tried), the point of temp tables it's a temp space where to store thing when you are writing stored procedures. If you are using PetaPoco it's much better to use C# memory structures (like List) to store the temp values....
cakephp,relationship,crud,cakephp-3.0
The name of table with associations should be "team_users". Three database tables are required for a BelongsToMany association. In the example above we would need tables for articles, tags and articles_tags. The articles_tags table contains the data that links tags and articles together. The joining table is named after the...
Well, Both the actions actually means update, where PUT is full update and PATCH is partial update. In case of PUT you already know the identifier of the resource and the resource already exists, so it is not a create and delete action per se. Infact, you can make do...
Ok, in fact it is an issue in Sensio Generator Bundle. In the file: sensio\generator-bundle\Sensio\Bundle\GeneratorBundle\Generator\DoctrineCrudGenerator.php the generateNewView function is missing a paramter. It is not passing the fields as opposed to generateShowView. Here is the comparison: protected function generateNewView($dir) { $this->renderFile('crud/views/new.html.twig.twig', $dir.'/new.html.twig', array( 'bundle' => $this->bundle->getName(), 'entity' => $this->entity, 'route_prefix'...
The acronym CRUD was invented as a means of describing the basic database operations. You will find that it often does not really apply to application level logic. For example, to authenticate a user, you need to create a server command that accepts credentials from and a client and the...
ruby-on-rails,ruby-on-rails-3,ruby-on-rails-4,crud
Move the namespace and resource routes above the match lines. Those two match lines are matching all routes, so your resource routes are never getting used. Your routes file should look like: Rails.application.routes.draw do root "auth#login" get 'shop', :to => "auth#index" namespace :admin do resources :countries end match ':controller(/:action(/:id))', :via...
dynamic,laravel,crud,laravel-routing
Laravel will not control the whole flow of your application. If you have a campaign delete router: Route::delete('campaign/{id}'); and it returns to campaigns class CampaignController extends Controller { public function delete($id) { $c = Campaign::find($id); $c->delete(); return Redirect::route('campaigns'); } } You will have to trick your route to make it...
Currently ArrayAdapter adapter is calling default toString method of Wiridan class and showing object string representation. To show judul_wiridan in ListView override toString method in Wiridan class : @Override public String toString() { return getJumlah_wiridan(); } Or create a custom adapter by extending ArrayAdapter to override getView method: Customizing Android...
angularjs,model-view-controller,crud
You can also use two different routes (e.g. /add, /edit/:id) to the same action, but still it's one name of the action for both operations :) But if you're using AngularJS you can easily implement RESTful web service integration and I strongly recommend it, if only you can do that....
mysql,database,stored-procedures,crud,identity
First of all there is no @@Identity in MySQL. You must have mistaken and probably talking about SQL Server. Coming to your case, if you are still getting out_result = 12 then I believe the corresponding UPDATE statement (as pointed below) didn't processed any row because the the condition WHERE...
ruby-on-rails,ruby,ruby-on-rails-4,crud
The error shows that there's no .build method. If you plan to initialize the Sportist for edit and update action, you'd need to pass the id from params to get the right model. Then for create, you need a new object. So for actions that handle an existing sportist, you'd...
nunit,automated-tests,bdd,crud,specflow
After some internal debate I decided that it was futile to try and reduce the tests I had already written into the BDD grammar of: [scenario name] [pre-condition] [action] [observation] And what I ended up with was something like this: [scenario name] [pre-condition] [action] [observation] [pre-condition] [action] [observation] ... [end]...
php,codeigniter,codeigniter-2,crud,grocery-crud
Here is a REST Server that seems to be maintained. https://github.com/chriskacerguis/codeigniter-restserver There is also GroceryCRUD if you want it in PHP still. http://www.grocerycrud.com/...
The error is extremly explicit. You are giving to the removeUser() function a string which is the user's id whereas the expected parameter type is a User. You must retrieve the user from the DB thanks to $id and then pass this user to the function....
There are two mistakes leading to the 404 error : echo '<a class="btn" href="crud_read.php?id='.$row['headid'].'">Read</a>'; The parameter id should be headid, so it is correctly retrieved in your crud_read.php $headid = null; if ( !empty($_GET['headid'])) { $headid = $_REQUEST['headid']; } if ( null==$headid ) { header("Location: read.php"); } In your case...
UPDATED WITH EXAMPLE. You doing bad mistake it's not the right way to do what you want. You should use ajax. Read here jQuery.AJAX guide . I made you example how to do it VERY BASIC but will do the job: HTML PAGE : <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> $ (document).ready(function...
ruby,ruby-on-rails-4,crud,strong-parameters
The main problem here is that if you have model named 'action', your params by default will be named in the same way, which collides with ActionController default params. The simplest solution is, I guess, renaming your model.
Thank you @lukad03, I did some messing around with your answer and figured out another way myself. I created another column to mimic the first and just made it equal to itself in the resource model using a variable. (like @lukad03 said) resource.rb before_create :decrement def decrement self.total = self.decrement...
For modifying queries you need to add an @Modifying to the method. Be sure you are aware of the side effects of the approach you chose: Executing a manipulating query is pretty much bypassing all EntityManager caches. Thus a subsequent findOne(…) might/will still return the old instance of the object...