I would second the use of backbone although it's not going to let you link the logic in your models with that in the browser.
One thing you might want to take a look at is the formtastic gem with activerecord reflections. This will add classnames to your form elements based on the validations set in your ActiveRecord models. From their you could link the class names with something like the jQuery validation plugin. That would give you basic end to end validations. Personally, I think it's too brittle however. Samuel Richardson www.richardson.co.nz | 0405 472 748 On Fri, Feb 11, 2011 at 4:42 PM, Ritchie Young <[email protected]> wrote: > I guess it's going to depend on your project and how involved the > business logic is. I can envisage in cases where you have a string of > calculations to do (like add up the value of the order items, calc > shipping and apply tax to display a total cost) it might not be very > DRY to redo that in JS. > > I can see 3 ways to deal with that: > > - Call the server to get the answer > - Write the logic in JS to start with and run JS on the server > - Compile Ruby into JS > > BTW: If you're still interested in the third option, this might > interest you: https://github.com/jessesielaff/red > > > On Fri, Feb 11, 2011 at 12:55 PM, Julio Cesar Ody <[email protected]> > wrote: > > Rather, from the original question, the problem as I see it is there's a > > misunderstanding of what has to be done in order to solve the problem. > > What the model does in the back-end doesn't have to be replicated in the > > view. Possibly what you'll have is, say, deleting an instance in JS > should > > remove a row in a <table>. That's nothing the actual Ruby class should > even > > care about. > > > > And take a look at backbone.js. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
