Ruby on Rails Tuesday, February 12, 2019

Rob, thank you for your reply.   I understand what you're saying about there really being no way to avoid using js.   I feel like the combination I can look forward to is using js in the front and rails in the back.


On Monday, February 11, 2019 at 5:29:04 AM UTC-5, Rob Jonson wrote:

I sense that Ruby (on Rails) isn't particularly geared for this type of interactivity.

It really is; It is not however geared for this type of interactivity if you need to exclude a key component of the ROR stack (javascript).
In fact - you're not going to deliver your project at all without js. 
Just have a look at the head section and you'll see that you're including a bunch of javascript which is core to the way that ROR works - even down to submitting forms and handling clicks!

  that JS isn't allowed.  I can use CSS and Bootstrap but no JS allowed in this particular project (JS is our next module).
 
moving on from the fact that you _are_ using javascript, you could ask what exactly they mean by this exclusion.
If they just want you to avoid writing explicit javacript that runs within the page (in /assets/javascripts), then they might allow partials.

this does use javascript - but typically only in a minimal way to replace a div or two with fresh html.
the js here lives in a view, but view.erb.js rather than view.erb.html

in your case, you could link up each seat to be a submit button on an individual form. (e.g. one form per seat), [you could also do each seat as a link with method: :post]
the partial would then either replace the whole plane, or replace the selected seat and the deselected seat.

this article gives some info on how this works

having said all that - it sounds like you might be jumping ahead. What you're trying to do is probably going to be covered in your next module!

enjoy,

Rob

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/71dd89dc-c77a-4b5c-b2da-7ed788341ead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment