werein / x-editable-rails

Edit fields easily with X-Editable helper

Home Page:https://wereinhq.com/guides/x-editable-rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changed value doesn't get updated in database

Rubioli opened this issue · comments

Great looking gem.

I have added x-editable-rails to my application. I can get the editor pop-up and when I edit the value, it gets updated in my view, but value doesn't get updated in my table/database, so when I refresh my page, the old value is showing.

Here is what I have:
My application.js:

//= require global
//= require editable/bootstrap-editable
//= require editable/rails

My global.js:
$('.editable').editable();

My application.scss
@import "editable/bootstrap-editable";

class ApplicationController < ActionController::Base
  helper_method :xeditable?
  def xeditable? object = nil
    true
  end

My view:

- @campaign.posts.each do |post|
  .col-md-12.div-table.brd-rad-4
    %span.editable= editable post, :cpc

What I am doing wrong?

Thanks in advanced!

Sorry, Got what I did wrong. I shouldn't add class: editable to my span

Thanks @jirikolarik I don't have anything on my controller, only in ApplicationController. Should I have something in my controller?

Now it works fine and my issue was that I had added class editable to my span

Then you don't need it, I was going through the dummy project to find out what might be wrong. I'm glad it works now

Thanks a bunch @jirikolarik. Great Gem :)

Hello @jirikolarik I hope you can help me here :). I got the gem to work for sometimes and I didn't changed anything with the view or the js code and it suddenly stopped working.

I still have the same setup as when I opened the issue. Appreciate any help