display_as not returning #100

Closed
BobWalsh opened this Issue Feb 6, 2012 · 5 comments

Projects

None yet

4 participants

@BobWalsh

in bankaccount model I have:

def mk_bal
ActionController::Base.helpers.number_to_currency(self.balance, :precision => 2)
end

in /show.rb I have:

<%= best_in_place @bankaccount, :balance, :display_as => :mk_bal %>

Value is displayed as ($1,234.56). After editing, new value displayed as 55555.

(Rails 3.2.1)

@davidelbe

Bob, if you use format.json { respond_with_bip(@bankaccount) } it should work as expected. You are probably just rendering it as json render :json => @bankaccount, right?

@bratsche

@standoutdavid 's comment fixed the problem for me. However, I noticed another issue.

1/ I edit a textarea, it saves and displays the new value.
2/ I try to edit again (without refreshing), but it's now using the original value rather than the value after the last edit.

The problem is that when I save the value, data-original-content doesn't get updated to reflect the changes. So next time I edit, it's still populating the editor based upon data-original-content from when the HTML was generated on the server side.

@BobWalsh

standoutdavid - That worked! Thanks very much!

@BobWalsh BobWalsh closed this Mar 5, 2012
@mjalkio

@bratsche , were you ever able to fix that issue? I'm experiencing it now and haven't been able to find a fix. I can't tell if Bob's issue is the same, but what you're experiencing is definitely what I'm trying to debug now.

@bratsche

@mjalkio I don't think I really tried very hard to fix that last one, no. Now I don't even recall where I was having that issue anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment