Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

as: checkbox value doesn't change on index view #585

Open
Lucones opened this issue Aug 4, 2017 · 1 comment
Open

as: checkbox value doesn't change on index view #585

Lucones opened this issue Aug 4, 2017 · 1 comment

Comments

@Lucones
Copy link

Lucones commented Aug 4, 2017

I'm doing a best_in_place for an boolean attribute in my index view table

finance/index.html.erb

<% @finances.each do |finance| %>
  <td><%= finance.receive %></td>         	
  <td><%= best_in_place finance, :status, as: :checkbox %> </td>

If I click on it, the status is changed in my db but it doesn't change on my view unless I perform a refresh.
Oddly if I do it with the "receive" attribute as an input, it works as intended, changing the value on my db and on my view without the need to refreshing the page.

I'm gueesing it is something with my update response. I've tried several ways of responding in my update controller method, here it is the last one I tried before recurring to this here.

finances_controller.rb

  def update
  	@finance = Finance.find(params[:id])
  	@finance.update(finance_params)
  	respond_with_bip(@finance)
  end

Keep in mind that it works fine with other types of best_in_place (at least with the input one)

@jaredjackson
Copy link

I think on the index view the url must be supplied. Try the following...

<%= best_in_place finance, :status, as: :checkbox, url: finance_path(finance) %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants