My app runs on two different database, and I use the application logic to work on them.
I have the User model on an external db and I only records the id on my default_role class.
So in the index template I fetch the accounts from remote, and for each of them I have to query my table to print some immutable information and I want to give the possibility to change role in my table
Index information = remote tables information (name surname ecc) + my table information (role)
Using best_in_place to edit the role_id field of my users.
The problem is my index cycle @operators which comes from outside buy I need to change role which is on my side!
- @operators.each do |ope| #cycle users
%tr
%td
- user = User.find_by_bay_id(ope.account_id)
- df = DefaultRole.find_by_operator_id(user.id)
= best_in_place [:admin, df], :role_id, :type => :select, :collection => [[1, 'admin'], [2, 'coordinator'], [3, 'operator'], [4, 'base']]
and my update in controller:
respond_to :html, :json
def index
@operators = some logic from model where I get all the users
end
def update
@df = DefaultRole.find(params[:id])
@df.update_attributes(params[:default_role])
respond_with [:admin, @df]
end
But it didn’t even call my update method in the controller.
It normally checks the collection tag, allows me to change it but it doesn’t allow me to submit.
What am I doing wrong?
EDIT
My browser doesn’t catch any request.
I finally found the error.
https://github.com/bernat/best_in_place/issues/217
It was a Jquery issue on that version of best_in_place. Running:
bundle updateand restarting the server solve the problem, thanks everyone