May 28, 2008
2483409_icon_small Jeff Cohen 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / RSpec ?

I think other BDD gems like Shoulda and test/spec are worthy of consideration, and not allow RSpec to be seen as the only choice.

 
Apr 26, 2008
2483409_icon_small Jeff Cohen 5 posts

Topic: Prototype and script.aculo.us / Drag & drop question about revert behavior

That worked perfectly! Awesome.

And now I see it’s explained on p. 289 in the description of the revert option. I totally missed it before even though I read that section.

Thanks again.
Jeff

 
Apr 26, 2008
2483409_icon_small Jeff Cohen 5 posts

Topic: Prototype and script.aculo.us / Drag & drop question about revert behavior

Hi,

Just wondering if there’s any known technique to cancel the revert action of a draggable depending on where it’s dropped?

I’m using Rails to build a simple chess app as a demo for a Rails class. Players can drag pieces to move them on the board. I’m successfully using the accept parameter to help restrict where a piece can land (empty square or enemy square). If dropped on an acceptable square, the drop succeeds and it calls the controller as expected.

But when dropped on an invalid square, the controller is not called (which is good), but the piece remains where it was dropped (which is bad). I’d like the piece to be reverted if the drop is not on an acceptable region. If I use :revert => true on the draggable element, it will always revert even on a valid move, which causes a flash effect since it reverts and then the board updates with the new position right after that.

I actually expected this to be the default behavior when I first learned about the accept option using CSS classes. If a piece is not dropped on an acceptable region, then of course it should be reverted, no?

Is there any way to achieve this functionality, either with RJS (hopefully?) or with direct Javascript?

Thanks!
Jeff

 
Apr 25, 2008
2483409_icon_small Jeff Cohen 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / ActiveResource?

I think that would be great. Thanks.

 
Apr 25, 2008
2483409_icon_small Jeff Cohen 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / ActiveResource?

Any chance there will be some discussion of ActiveResource this time around? There is some major refactoring going into edge, with a new ActiveModel class, etc. If it results in a more usable ActiveResource, then it would be helpful to include it as a topic in the book.

Thanks!
Jeff

5 posts