Building basic airline reservation system with Ruby on Rails

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Building basic airline reservation system with Ruby on Rails

Daniel Toma
I'm 5 weeks into a training program that consists of Ruby, Ruby on Rails, Javascript, and React.  I'm about the wrap up the 3-week module for Ruby on Rails, and chose to do a project that simulates a basic airline reservation system.
The requirements are minimal:  have at least 3 classes (one being a join class) and use the CRUD methods with a Postgresql db.  The processes of creating a reservation, reading an existing reservation, updating a reservation, and deleting a reservation are straightforward, but I'd like to jazz it up a bit for the presentation.

I have the code that eliminates a seat from the list of available seats once that seat is reserved, but I was wondering if there's a way to incorporate a standard graphic that shows which seats are available (usually a green color) and which are taken (usually gray with an 'X').    I'm thinking that the graphic would be an HTML form with embedded Ruby, and that each "seat" could be represented.  The graphic would represent my Index.html.erb view, that would show the seat number and its status (occupied vs. available).  I just can't think of how this would be done, and I was wondering if anyone had an idea.



Screen Shot 2019-02-09 at 4.47.22 PM.png


--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d1beb902-301e-4bfd-bf0e-c42fabf2cd05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Hasan Diwan
Daniel,

On Sat, 9 Feb 2019 at 23:13, Daniel Toma <[hidden email]> wrote:
  I just can't think of how this would be done, and I was wondering if anyone had an idea.

While you could use ruby for this, a Javascript solution is going to be less heavy on the server. Simply define a class for blue and a class for red as follows in CSS:

.available { background-image("//location/of/green/image"); }
.taken { background-image("//location/of/red/image"); }
.na { background-image("//location/of/unavailable/image"}; }

Now that these are defined, you can set the class on submit using jquery's .addClass after removing the old one using .removeClass. Good luck, matey and let me know if you need further assistance.

--
If you wish to request my time, please do so using bit.ly/hd1AppointmentRequest.
Si vous voudrais faire connnaisance, allez a bit.ly/hd1AppointmentRequest.

Sent from my mobile device
Envoye de mon portable

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAP%2BbYWCA5V8pekvCyF09BJnxce8cZOBXqOJ352v%2BQ79NgusXmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Screen Shot 2019-02-09 at 4.47.22 PM.png (1M) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Joe Guerra
In reply to this post by Daniel Toma
Wow, very nice.  Where you taking your training?  

On Sunday, February 10, 2019 at 2:13:34 AM UTC-5, Daniel Toma wrote:
I'm 5 weeks into a training program that consists of Ruby, Ruby on Rails, Javascript, and React.  I'm about the wrap up the 3-week module for Ruby on Rails, and chose to do a project that simulates a basic airline reservation system.
The requirements are minimal:  have at least 3 classes (one being a join class) and use the CRUD methods with a Postgresql db.  The processes of creating a reservation, reading an existing reservation, updating a reservation, and deleting a reservation are straightforward, but I'd like to jazz it up a bit for the presentation.

I have the code that eliminates a seat from the list of available seats once that seat is reserved, but I was wondering if there's a way to incorporate a standard graphic that shows which seats are available (usually a green color) and which are taken (usually gray with an 'X').    I'm thinking that the graphic would be an HTML form with embedded Ruby, and that each "seat" could be represented.  The graphic would represent my Index.html.erb view, that would show the seat number and its status (occupied vs. available).  I just can't think of how this would be done, and I was wondering if anyone had an idea.



Screen Shot 2019-02-09 at 4.47.22 PM.png


--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c4b3493b-52c1-4948-bbb9-94cf3a84c8a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Daniel Toma
It's called Flatiron School.  Their main "campus" is in Manhattan.  I'm at one of their offices called Access Labs, in Brooklyn.


On Sunday, February 10, 2019 at 2:27:35 PM UTC-5, Joe Guerra wrote:
Wow, very nice.  Where you taking your training?  

On Sunday, February 10, 2019 at 2:13:34 AM UTC-5, Daniel Toma wrote:
I'm 5 weeks into a training program that consists of Ruby, Ruby on Rails, Javascript, and React.  I'm about the wrap up the 3-week module for Ruby on Rails, and chose to do a project that simulates a basic airline reservation system.
The requirements are minimal:  have at least 3 classes (one being a join class) and use the CRUD methods with a Postgresql db.  The processes of creating a reservation, reading an existing reservation, updating a reservation, and deleting a reservation are straightforward, but I'd like to jazz it up a bit for the presentation.

I have the code that eliminates a seat from the list of available seats once that seat is reserved, but I was wondering if there's a way to incorporate a standard graphic that shows which seats are available (usually a green color) and which are taken (usually gray with an 'X').    I'm thinking that the graphic would be an HTML form with embedded Ruby, and that each "seat" could be represented.  The graphic would represent my Index.html.erb view, that would show the seat number and its status (occupied vs. available).  I just can't think of how this would be done, and I was wondering if anyone had an idea.



Screen Shot 2019-02-09 at 4.47.22 PM.png


--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8ff9a25f-20f0-418e-9f18-043a36fc6515%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Daniel Toma
In reply to this post by Hasan Diwan
Hi, thank you very much for replying.  I forgot to mention a biggie:   that JS isn't allowed.  I can use CSS and Bootstrap but no JS allowed in this particular project (JS is our next module).
I sense that Ruby (on Rails) isn't particularly geared for this type of interactivity.


On Sunday, February 10, 2019 at 2:25:30 AM UTC-5, [hidden email] wrote:
Daniel,

On Sat, 9 Feb 2019 at 23:13, Daniel Toma <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="2o5Ae0FUIQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">toma...@...> wrote:
  I just can't think of how this would be done, and I was wondering if anyone had an idea.

While you could use ruby for this, a Javascript solution is going to be less heavy on the server. Simply define a class for blue and a class for red as follows in CSS:

.available { background-image("//location/of/green/image"); }
.taken { background-image("//location/of/red/image"); }
.na { background-image("//location/of/unavailable/image"}; }

Now that these are defined, you can set the class on submit using jquery's .addClass after removing the old one using .removeClass. Good luck, matey and let me know if you need further assistance.

--
OpenPGP: <a href="https://sks-keyservers.net/pks/lookup?op=get&amp;search=0xFEBAD7FFD041BBA1" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fsks-keyservers.net%2Fpks%2Flookup%3Fop%3Dget%26search%3D0xFEBAD7FFD041BBA1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGDuCTKSPl7dcRwq_hJqIzf3yiIog&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fsks-keyservers.net%2Fpks%2Flookup%3Fop%3Dget%26search%3D0xFEBAD7FFD041BBA1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGDuCTKSPl7dcRwq_hJqIzf3yiIog&#39;;return true;">https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using <a href="http://bit.ly/hd1AppointmentRequest" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbit.ly%2Fhd1AppointmentRequest\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFt-RujjBqmDCEgp-tLnm421i0Keg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbit.ly%2Fhd1AppointmentRequest\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFt-RujjBqmDCEgp-tLnm421i0Keg&#39;;return true;">bit.ly/hd1AppointmentRequest.
Si vous voudrais faire connnaisance, allez a <a href="http://bit.ly/hd1AppointmentRequest" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbit.ly%2Fhd1AppointmentRequest\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFt-RujjBqmDCEgp-tLnm421i0Keg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fbit.ly%2Fhd1AppointmentRequest\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFt-RujjBqmDCEgp-tLnm421i0Keg&#39;;return true;">bit.ly/hd1AppointmentRequest.
<a href="https://sks-keyservers.net/pks/lookup?op=get&amp;search=0xFEBAD7FFD041BBA1" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fsks-keyservers.net%2Fpks%2Flookup%3Fop%3Dget%26search%3D0xFEBAD7FFD041BBA1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGDuCTKSPl7dcRwq_hJqIzf3yiIog&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fsks-keyservers.net%2Fpks%2Flookup%3Fop%3Dget%26search%3D0xFEBAD7FFD041BBA1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGDuCTKSPl7dcRwq_hJqIzf3yiIog&#39;;return true;">
Sent from my mobile device
Envoye de mon portable

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6114bedb-e26d-4da1-b958-bc7efd99ada3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Hassan Schroeder-2
On Sun, Feb 10, 2019 at 3:55 PM Daniel Toma <[hidden email]> wrote:
>
> Hi, thank you very much for replying.  I forgot to mention a biggie:   that JS isn't allowed.  I can use CSS and Bootstrap but no JS allowed in this particular project (JS is our next module).
> I sense that Ruby (on Rails) isn't particularly geared for this type of interactivity.

If you want client-side "interactivity" JavaScript is the only option.

Rails is no different in this respect from any other server technology.

--
Hassan Schroeder ------------------------ [hidden email]
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAoXYaO0_mRnkeeeSjnSccyHCD-w9fuRKsutPN2Lr1S_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Rob Jonson
In reply to this post by Daniel Toma

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
https://blog.codeship.com/unobtrusive-javascript-via-ajax-rails/

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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ee3a68e8-4a28-4acd-91a9-3ebeeb68ee55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Rob Zolkos-2
In reply to this post by Daniel Toma
This is totally doable without javascript.    Rails works perfectly fine without Javascript.    

You will need to re-render the page from the server on any change/submit.  That is ok (I suspect the exercise they are trying to teach you is that these sorts of interactions *can* be done in a server rendered way but when you get to the JS modules it will be easier and a better experience for the customer).    

Each seat would need to be a submit button and on the server you would check the value of params[:commit] to validate.  Once the seat is assigned/allocated you would re-render the page and show the correct styling.

  <% @seats.each do |seat| %>
    <% if seat.occupied %>
      <div class="occupied">X</div>
    <% else %>
      <%= f.submit seat.id, class: "available" %>
    <% end %>
  <% end %>

On Mon, Feb 11, 2019 at 9:55 AM Daniel Toma <[hidden email]> wrote:
Hi, thank you very much for replying.  I forgot to mention a biggie:   that JS isn't allowed.  I can use CSS and Bootstrap but no JS allowed in this particular project (JS is our next module).
I sense that Ruby (on Rails) isn't particularly geared for this type of interactivity.


On Sunday, February 10, 2019 at 2:25:30 AM UTC-5, [hidden email] wrote:
Daniel,

On Sat, 9 Feb 2019 at 23:13, Daniel Toma <[hidden email]> wrote:
  I just can't think of how this would be done, and I was wondering if anyone had an idea.

While you could use ruby for this, a Javascript solution is going to be less heavy on the server. Simply define a class for blue and a class for red as follows in CSS:

.available { background-image("//location/of/green/image"); }
.taken { background-image("//location/of/red/image"); }
.na { background-image("//location/of/unavailable/image"}; }

Now that these are defined, you can set the class on submit using jquery's .addClass after removing the old one using .removeClass. Good luck, matey and let me know if you need further assistance.

--
If you wish to request my time, please do so using bit.ly/hd1AppointmentRequest.
Si vous voudrais faire connnaisance, allez a bit.ly/hd1AppointmentRequest.

Sent from my mobile device
Envoye de mon portable

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6114bedb-e26d-4da1-b958-bc7efd99ada3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAJ6MPzJX3muMz1UaJ%3DvZZYEpZ9x4mMgvv26ZLAr0Bhqswc7bBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Rob Jonson-2
Rails works perfectly fine without Javascript.    

I'm veering into the pedantic here...

Rails certainly can work fine without Javascript. As you say in this booking example, you can certainly just re-render the page completely on the server (even if it is 'icky'!)

However to really use rails without javascript you would have to be careful to avoid the many standard features which are implemented using js.

e.g.

<%= link_to  "test link", test_path, method: :post %>

This submits via POST normally, but via GET if you disable javascript in your browser (or if you don't include the standard js includes)
When I started writing Rails, it was normal to consider that a meaningful proportion of your customers would not have js, and write the app to handle that case.

Today, I certainly wouldn't waste time coding for the 'what if they don't have js' scenario.

cheers,

Rob







On Mon, 11 Feb 2019 at 11:17, Rob Zolkos <[hidden email]> wrote:
This is totally doable without javascript.    Rails works perfectly fine without Javascript.    

You will need to re-render the page from the server on any change/submit.  That is ok (I suspect the exercise they are trying to teach you is that these sorts of interactions *can* be done in a server rendered way but when you get to the JS modules it will be easier and a better experience for the customer).    

Each seat would need to be a submit button and on the server you would check the value of params[:commit] to validate.  Once the seat is assigned/allocated you would re-render the page and show the correct styling.

  <% @seats.each do |seat| %>
    <% if seat.occupied %>
      <div class="occupied">X</div>
    <% else %>
      <%= f.submit seat.id, class: "available" %>
    <% end %>
  <% end %>

On Mon, Feb 11, 2019 at 9:55 AM Daniel Toma <[hidden email]> wrote:
Hi, thank you very much for replying.  I forgot to mention a biggie:   that JS isn't allowed.  I can use CSS and Bootstrap but no JS allowed in this particular project (JS is our next module).
I sense that Ruby (on Rails) isn't particularly geared for this type of interactivity.


On Sunday, February 10, 2019 at 2:25:30 AM UTC-5, [hidden email] wrote:
Daniel,

On Sat, 9 Feb 2019 at 23:13, Daniel Toma <[hidden email]> wrote:
  I just can't think of how this would be done, and I was wondering if anyone had an idea.

While you could use ruby for this, a Javascript solution is going to be less heavy on the server. Simply define a class for blue and a class for red as follows in CSS:

.available { background-image("//location/of/green/image"); }
.taken { background-image("//location/of/red/image"); }
.na { background-image("//location/of/unavailable/image"}; }

Now that these are defined, you can set the class on submit using jquery's .addClass after removing the old one using .removeClass. Good luck, matey and let me know if you need further assistance.

--
If you wish to request my time, please do so using bit.ly/hd1AppointmentRequest.
Si vous voudrais faire connnaisance, allez a bit.ly/hd1AppointmentRequest.

Sent from my mobile device
Envoye de mon portable

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6114bedb-e26d-4da1-b958-bc7efd99ada3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/wgTcZ7C8mho/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAJ6MPzJX3muMz1UaJ%3DvZZYEpZ9x4mMgvv26ZLAr0Bhqswc7bBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--





Hobbyist Software is a trading name of Hobbyist Software Limited. Registered office 12 Fraley Rd, Bristol, BS93BS. Registered in England. Company no:7876492

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACTOy%2BrMHKB0sCJ2XEMJT5XQKZazLUBdwD3ZUHn4axamj%3DRfWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Daniel Toma
In reply to this post by Rob Jonson
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
<a href="https://blog.codeship.com/unobtrusive-javascript-via-ajax-rails/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fblog.codeship.com%2Funobtrusive-javascript-via-ajax-rails%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH6cOC_6AnTGBLPlbuEZpkk9ce9rA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fblog.codeship.com%2Funobtrusive-javascript-via-ajax-rails%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH6cOC_6AnTGBLPlbuEZpkk9ce9rA&#39;;return true;">https://blog.codeship.com/unobtrusive-javascript-via-ajax-rails/

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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Building basic airline reservation system with Ruby on Rails

Phil Edelbrock
In reply to this post by Daniel Toma


> On Feb 9, 2019, at 1:55 PM, Daniel Toma <[hidden email]> wrote:
>
> I'm 5 weeks into a training program that consists of Ruby, Ruby on Rails, Javascript, and React.  I'm about the wrap up the 3-week module for Ruby on Rails, and chose to do a project that simulates a basic airline reservation system.
> The requirements are minimal:  have at least 3 classes (one being a join class) and use the CRUD methods with a Postgresql db.  The processes of creating a reservation, reading an existing reservation, updating a reservation, and deleting a reservation are straightforward, but I'd like to jazz it up a bit for the presentation.
>
> I have the code that eliminates a seat from the list of available seats once that seat is reserved, but I was wondering if there's a way to incorporate a standard graphic that shows which seats are available (usually a green color) and which are taken (usually gray with an 'X').    I'm thinking that the graphic would be an HTML form with embedded Ruby, and that each "seat" could be represented.  The graphic would represent my Index.html.erb view, that would show the seat number and its status (occupied vs. available).  I just can't think of how this would be done, and I was wondering if anyone had an idea.
>

That looks like a really fun project.  In the early 90's (yes, I'm old) I was commissioned to write a MacOS app for ticket sellers for venues where they could click on a similar seat layout to toggle their status from available to unavailable and be able to save the state and load it up later.  (This was all in C at the time.)

Today I write software for property management in RoR to reserve dates for reservations for several hundred properties.

Anyway, for the purpose of your demo... you could cheat without using any JS and without having to reload the page if you just want a visual effect?

Something like this:

<html>
<head>
<style>
a:visited {
  background-color: yellow;
}

a:link {
  background-color: pink;
}
</style>
</head>
<body>
<p><a href="#1">Seat</a></p>
<p><a href="#2">Seat</a></p>
</body>
</html>

Good luck!


Phil

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/92383EAA-0B61-45D3-A119-23A8C60D2BC7%40gmail.com.
For more options, visit https://groups.google.com/d/optout.