<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ljg2gb</title>
    <description>The latest articles on DEV Community by ljg2gb (@ljg2gb).</description>
    <link>https://dev.to/ljg2gb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F416764%2F4a680c5a-2828-4c6c-9223-ce9d58c6a0fb.png</url>
      <title>DEV Community: ljg2gb</title>
      <link>https://dev.to/ljg2gb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ljg2gb"/>
    <language>en</language>
    <item>
      <title>An Intro to Web Accessibility for Developers</title>
      <dc:creator>ljg2gb</dc:creator>
      <pubDate>Thu, 03 Sep 2020 20:59:31 +0000</pubDate>
      <link>https://dev.to/ljg2gb/an-intro-to-web-accessibility-for-developers-1el</link>
      <guid>https://dev.to/ljg2gb/an-intro-to-web-accessibility-for-developers-1el</guid>
      <description>&lt;p&gt;The Pandemic has changed so much about how we all live our lives. In one one way or another, we’ve all had to adapt to this “new normal”. In reflecting on these adjustments, a major theme for me has been internet access and how we can help expand it.&lt;/p&gt;

&lt;p&gt;Living through this Pandemic, we rely on internet services to go to work, go to school, catch up with loved ones, do our shopping, and even go to our doctors’ appointments. Unlike ever before, people with disabilities, people with technical challenges, and people from different cultural/linguistic backgrounds are convening in the digital space, and are relying on web-based services and platforms.&lt;/p&gt;

&lt;p&gt;As developers, we have a responsibility, along with designers, to create and optimize interfaces to be inclusive and accessible to everyone.&lt;/p&gt;

&lt;p&gt;In learning more about web accessibility and how to implement it, I’ve gone down a bit of a rabbit hole. While I am merely scratching the surface, I decided to put together a list of quick wins that fellow developers can implement in an afternoon, as well as some resources that I found helpful.&lt;br&gt;
Please know that there are plenty of experts on this topic, and whole courses on web accessibility. I don’t want to replace these voices and would highly recommend that you go check them out if you are interested in the subject. If you’re looking for a quick way to make your project more accessible, I hope you find that this article is a good place to start.&lt;/p&gt;
&lt;h2&gt;
  
  
  Implementing Quick Wins for Accessibility
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Optimize your Website for Screen Readers
&lt;/h3&gt;

&lt;p&gt;Screen readers allow people who are blind or visually impaired to navigate the web. They work by parsing the HTML of a webpage and using text-to-speech technologies. Unlike navigating a page by sight, where users can scan to find the content they are looking for easily, screen readers read linearly. This should be considered when designing a webpage. You can try out a screen reader on your site with NVDA for Windows or VoiceOver for Mac.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://webaim.org/techniques/screenreader/" rel="noopener noreferrer"&gt;Set the document language&lt;/a&gt;: the lang attribute on the  tag tells a screen reader what language to read the content in. &lt;a href="https://webaim.org/techniques/screenreader/" rel="noopener noreferrer"&gt;Here&lt;/a&gt;, WebAIM gives a great example of what it sounds like if the defaulted language doesn’t match the language of the content.&lt;/li&gt;
&lt;li&gt;Include alt-text: Including alt-text to images, videos, graphs, and other media allow people using screen readers full-access to content.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.a11yproject.com/posts/2019-02-15-creating-valid-and-accessible-links/" rel="noopener noreferrer"&gt;Check for empty links and buttons&lt;/a&gt;: Links that don’t contain text mean there’s no context as to what the link goes to, making it very difficult to navigate with a screen reader.&lt;/li&gt;
&lt;li&gt;Use semantically correct input labels on forms: This is another common context problem. For example, having a &lt;p&gt; tag that says ‘first name’ above an input field my be clear to those visibly navigating a page but difficult for those using screen readers.
&lt;/p&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form action="/action_page.js"&amp;gt;
    &amp;lt;label for="first-name"&amp;gt;First Name&amp;lt;/label&amp;gt;
    &amp;lt;input name="first-name"&amp;gt;
    &amp;lt;input type="submit" value="Submit"&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Style Thoughtfully
&lt;/h3&gt;

&lt;p&gt;Many people who are visually impaired still access the web visually. Colorblindness, for example, affects 300 million people worldwide. Epileptic users should also be considered when styling a webpage.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://accessibility.psu.edu/fontsizehtml/#:~:text=Ensure%20that%20default%20fonts%20are,which%20can%20accommodate%20200%25%20text." rel="noopener noreferrer"&gt;Check font-size&lt;/a&gt;: A small font can be difficult for some users to read. The WCAG guidelines recommend that no text is smaller than 9px.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://webaim.org/blog/wcag-2-0-and-link-colors/#:~:text=WCAG%202.0%20requires%20that%20the,any%20foreground%20and%20background%20color." rel="noopener noreferrer"&gt;Check contrast&lt;/a&gt;: Low contrast makes it difficult to impossible to see content for some. As a good rule of thumb design with high contrast between background and text colors. You can use this checker to see if your site’s contrast meets the guidelines. It’s also important that the meaning of an element isn’t conveyed by color alone.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.washington.edu/accessibility/checklist/flashing-content/" rel="noopener noreferrer"&gt;Watch out for flashing colors&lt;/a&gt;: Gif’s videos, animations, etc. can be distracting for many people and dangerous for people with epilepsy. Multimedia that flashes at a rate of 3+ per second should be removed and looping videos should have clear controls to be able to pause.
###Allow for Keyboard Navigation
Those with mobility issues may be navigating a site via a keyboard instead of using a mouse or trackpad.&lt;/li&gt;
&lt;li&gt;Set keystrokes for click events: If you are using VSCode and have ESLint installed, you might already know about this one as it will give you a warning in the console. Luckily for developers, many interactive HTML elements like buttons and links are written with default keystrokes. However, events like onClick or hover should be accompanied by a keystroke event like onKeyDown. Here’s an example from one of my own projects.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkoswuqvdp232465ufd90.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkoswuqvdp232465ufd90.png" alt="Example of keystroke event: &amp;lt;div onClick={() =&amp;gt; navigateTo()} onKeyDown={() =&amp;gt; handleKeyDown()}/&amp;gt;"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Some Great Resources to Check Out
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.a11yproject.com/" rel="noopener noreferrer"&gt;The A11y Project&lt;/a&gt; | a one-stop-shop for lots of accessibility information&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://a11y.coffee/" rel="noopener noreferrer"&gt;A11y.coffee&lt;/a&gt; | digestible information for developers to learn over a cup of coffee.&lt;/li&gt;
&lt;li&gt;Follow &lt;a href="https://twitter.com/cariefisher?lang=en" rel="noopener noreferrer"&gt;@cariefisher&lt;/a&gt; on Twitter&lt;/li&gt;
&lt;li&gt;MDN &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Accessibility" rel="noopener noreferrer"&gt;Accessibility&lt;/a&gt; + &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Navigation_Role" rel="noopener noreferrer"&gt;ARIA&lt;/a&gt; pages&lt;/li&gt;
&lt;li&gt;Accessibility evaluations tools like &lt;a href="https://wave.webaim.org/" rel="noopener noreferrer"&gt;WAVE&lt;/a&gt; and &lt;a href="https://khan.github.io/tota11y/" rel="noopener noreferrer"&gt;tota11y&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I hope you enjoyed this article. If you have any comments or suggestions, please email me at &lt;a href="mailto:lydia.gregory.dev@gmail.com"&gt;lydia.gregory.dev@gmail.com&lt;/a&gt;. I’d love to hear your feedback :)&lt;/p&gt;

</description>
      <category>a11y</category>
    </item>
    <item>
      <title>Making a Site Responsive</title>
      <dc:creator>ljg2gb</dc:creator>
      <pubDate>Thu, 27 Aug 2020 15:38:46 +0000</pubDate>
      <link>https://dev.to/ljg2gb/making-a-site-responsive-1ogh</link>
      <guid>https://dev.to/ljg2gb/making-a-site-responsive-1ogh</guid>
      <description>&lt;p&gt;While it’s easier to design and style for various screen sizes from the beginning, sometimes we realize the need to add flexibility to our projects after we've begun. &lt;strong&gt;If you are retroactively adding responsiveness to an existing app, you've come to the right place.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Some background:
&lt;/h3&gt;

&lt;p&gt;Learning to code in a Bootcamp program has lots of advantages. A project-focused program was great for me to solidify what I was learning. I built databases, CRUD backends, Jamstack applications, and modern web frameworks in four-day-long project sprints, and presented these projects to my classmates at the end of the week. &lt;/p&gt;

&lt;p&gt;As a former graphic designer, I always made time to plan out and implement basic wireframes, colors, and typography in my projects. But I never got the time to learn or implement responsive design in any of my projects during the Bootcamp, which meant that after graduating I was left with four projects that I was proud of, but had no responsiveness. &lt;/p&gt;

&lt;p&gt;Since I still hoped to deploy some of them, learning responsive web design and adding it to already existing projects was something that I wanted to do after graduating. After all, the majority of sites get more traffic from mobile devices than they do from a desktop.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Adding Responsiveness...
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.  Find What Breaks
&lt;/h3&gt;

&lt;p&gt;Take some time fiddling with the size of your browser window and make a list of components that need the most work. You can also use your chrome developer tools to snap the browser to key breakpoints including tablet and mobile. Note that absolutely positioned items are very hard to work with and should be used sparingly.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.  Use a Sass or SCSS file instead of CSS
&lt;/h3&gt;

&lt;p&gt;Using variables and mixins will make your stylesheet much more organized and readable. Variables also let you easily make one edit that will update your entire stylesheet.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Convert &lt;a href="https://www.w3schools.com/cssref/css_units.asp"&gt;CSS Units&lt;/a&gt; from absolute to relative
&lt;/h3&gt;

&lt;p&gt;Replace any absolute length units (px, pt, pc, in) to relative length units (em, vh, vw, %). This will automatically make your application much more flexible.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.  Use Media Queries
&lt;/h3&gt;

&lt;p&gt;Start fixing the most glaring scaling issues first, and work your way down to the details. Set your breakpoints with Sass variables and then use a media query such as &lt;code&gt;@media (max-width: 600px)&lt;/code&gt; or &lt;code&gt;@media (max-width: $phone)&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  5.  Flexed items
&lt;/h3&gt;

&lt;p&gt;Items that are flexed in the desktop version rarely have the horizontal space on mobile. One media query that I found myself writing often was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.text-container
     display: flex
     @media (max-width: 600px)
          flex-direction: column

// also written like:
.text-container
     @media (min-width: 600px)
          display: flex
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  6.  Images
&lt;/h3&gt;

&lt;p&gt;Images can be finicky when scaling down the screen size. By putting your image inside a div, you can fit the image to the div, which is easier to manipulate. Here are two ways to fit the image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.image-container
     .image
          object-fit: contain
//or
.image-container
     .image
          max-width: 100%
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Thanks for reading! &lt;/p&gt;

&lt;p&gt;If you have any comments or suggestions, please feel free to email me at &lt;em&gt;&lt;a href="mailto:lydia.gregory.dev@gmail.com"&gt;lydia.gregory.dev@gmail.com&lt;/a&gt;&lt;/em&gt;.&lt;/p&gt;

</description>
      <category>responsivedesign</category>
      <category>mediaqueries</category>
      <category>css</category>
      <category>beginners</category>
    </item>
    <item>
      <title>A First-Impression of Mobile Development</title>
      <dc:creator>ljg2gb</dc:creator>
      <pubDate>Mon, 06 Jul 2020 03:59:59 +0000</pubDate>
      <link>https://dev.to/ljg2gb/a-first-impression-of-mobile-development-36a2</link>
      <guid>https://dev.to/ljg2gb/a-first-impression-of-mobile-development-36a2</guid>
      <description>&lt;p&gt;As a web dev newbie trying out Mobile Development for the first time, I'm learning over and over again the importance of developing with User Experience as a top priority. As &lt;a href="https://frankchimero.com/"&gt;Frank Chimero&lt;/a&gt; puts it,  &lt;em&gt;&lt;strong&gt;"People ignore design that ignores people."&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For my very first mobile project, I decided to build a photo application in React Native that borrowed some of the interactivity of a Polaroid camera (like shaking your phone to develop your photo). In embarking on the project, I figured the most difficult challenge was going to be technical; learning the new tech. What I didn't realize was how much thought and preparation I'd be putting into developing an app with satisfactory user experience, let alone a good one.&lt;/p&gt;

&lt;p&gt;As I've done many times already in my short time as a developer, I've stumbled upon a rabbit hole. This one in particular, even though I don't have the time to go down it now, I have every intention of coming back to later. &lt;/p&gt;

&lt;p&gt;In web development, the browser handles a lot of the user's interaction with a site by default. Sites live in the browser and the browser has preset rules, which aren't broken often. (Think of the little jolt of surprise you get when you go to scroll down and a site's content starts moving to the right instead.)&lt;/p&gt;

&lt;p&gt;In mobile, it's free for all. Users can click anywhere, swipe anywhere, tilt, shake, move locations, etc. The developers (along with designers of course) are in charge of setting the rules. This means that when I create a component in my React Native project, I'm not only thinking about its state, props, style, and functionality. In mobile development, I'm also asking questions about how the user interacts with that component and how the component changes in response.&lt;/p&gt;

&lt;p&gt;Questions like, &lt;em&gt;"If a user swipes in x direction in x part of the screen, for x many pixels change will my app render to the right thing?"&lt;/em&gt;. &lt;em&gt;"What kind of feedback should I give the user to let them know that they are physically interacting with the app correctly?"&lt;/em&gt;. &lt;em&gt;"What conventions exist in mobile development and how can I implement them in my app?"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In the browser, many conventional actions are default actions. In mobile development, at least at the moment, that doesn't seem to be the case. Like my earlier example, convention lets the user scroll down and expect the page to move down. The browser's default gives the developer this convention for free.&lt;/p&gt;

&lt;p&gt;Whether I find myself working in web or mobile development, the experience of having developed in both has been eye-opening. Specifically, the unavoidable intentionality you need when developing a good user experience for mobile is a practiced skill of mobile developers and a translatable skill to Web.&lt;/p&gt;

&lt;p&gt;Jumping headfirst into my first mobile project only two weeks ago, I know I have so much still to learn. Here are some of my takeaways so far: &lt;/p&gt;

&lt;p&gt;1) Design beyond the default. &lt;br&gt;
2) Consider convention. &lt;br&gt;
3)Provide strong user feedback even on the web.&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>ux</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Deploying a Ruby on Rails API to Heroku</title>
      <dc:creator>ljg2gb</dc:creator>
      <pubDate>Tue, 30 Jun 2020 00:40:02 +0000</pubDate>
      <link>https://dev.to/ljg2gb/deploying-a-ruby-on-rails-api-to-heroku-382d</link>
      <guid>https://dev.to/ljg2gb/deploying-a-ruby-on-rails-api-to-heroku-382d</guid>
      <description>&lt;h2&gt;
  
  
  First Time Users
&lt;/h2&gt;

&lt;p&gt;Note: These are tailored instructions for deploying a Ruby on Rails API to Heroku for the first time. If you already have a Heroku account scroll to the Returning Users section :)&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a Heroku account
&lt;/h3&gt;

&lt;p&gt;1) This part is self-explanatory. Here's the link: &lt;a href="https://signup.heroku.com/"&gt;https://signup.heroku.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) You'll be creating a new app and adding your app's name and region.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up Heroku
&lt;/h3&gt;

&lt;p&gt;1) Install Heroku CLI. On a Mac, if you have homebrew, run &lt;code&gt;brew tap heroku/brew &amp;amp;&amp;amp; brew install heroku&lt;/code&gt; in the terminal, otherwise check out the &lt;a href="//devcenter.heroku.com/articles/heroku-cli"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;2) In the root directory of your backend, run &lt;code&gt;heroku login&lt;/code&gt; and login as prompted.&lt;/p&gt;

&lt;p&gt;3) Also in the root directory of your backend Rails application, if it's already a git repository, run &lt;code&gt;heroku git:remote -a &amp;lt;app_name&amp;gt;&lt;/code&gt;. The app name must be the same as the name you used on Heroku.&lt;/p&gt;

&lt;h3&gt;
  
  
  Changing your database from its default, SQLite3 to PostreSQL
&lt;/h3&gt;

&lt;p&gt;Note: If you've yet to create your Rails backend, you can initialize it with a PostgreSQL database using &lt;code&gt;--database=postgresql&lt;/code&gt; or &lt;code&gt;-d=postgresql&lt;/code&gt; e.g. &lt;code&gt;rails new &amp;lt;app_name&amp;gt; --api -d=postgresql&lt;/code&gt; and skip these next steps.&lt;/p&gt;

&lt;p&gt;Another note: If you have information in your database that should not be deleted, MIGRATE entries before continuing. I found an article that looks helpful &lt;a href="https://tutorialinux.com/today-learned-migrating-sqlite-postgres-easy-sequel/"&gt;here&lt;/a&gt;(although I haven't needed to do this so take the recommendation with a grain of salt!).&lt;/p&gt;

&lt;p&gt;1) Go to Rails Gemfile. Edit lines 8 and 9 from SQLite3 to &lt;code&gt;# Use postgresql as the database for Active Record&lt;br&gt;
 gem 'pg'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2) In config/database.yml, delete all commented-out code having to do with Sqlite3 (Heroku won’t like it). Change the default adapter to &lt;code&gt;postgresql&lt;/code&gt;, and the development database, test database, and production database to &lt;code&gt;app_name_development&lt;/code&gt;, &lt;code&gt;app_name_test&lt;/code&gt;, and &lt;code&gt;app_name_production&lt;/code&gt; respectively.&lt;/p&gt;

&lt;p&gt;3) Delete Gemfile.lock (&lt;code&gt;rm Gemfile.lock&lt;/code&gt;). Then run &lt;code&gt;bundle install&lt;/code&gt;. This will recreate your Gemfile AND delete your old SQLite3 database(s).&lt;/p&gt;

&lt;p&gt;4) Run &lt;code&gt;rails db:create&lt;/code&gt; and to create your new development and test databases.&lt;/p&gt;

&lt;p&gt;5) Run &lt;code&gt;rails db:migrate&lt;/code&gt; and &lt;code&gt;heroku run rails db:migrate&lt;/code&gt; to create your tables locally and on Heroku. Check here to make sure everything looks good before moving on.&lt;/p&gt;

&lt;p&gt;6) If you have seeds, at this point you can run &lt;code&gt;rails db:seed&lt;/code&gt; and &lt;code&gt;heroku run rails db:seed&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;6) Add and commit these changes to git. If you haven't synced Heroku with your Github, run &lt;code&gt;git push heroku master&lt;/code&gt;. Note: this command won't run unless you installed Heroku as listed in the steps above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syncing Heroku w/ Github
&lt;/h3&gt;

&lt;p&gt;1) If you have a GitHub repo that you'd like to link to Heroku, it's super easy. &lt;/p&gt;

&lt;p&gt;2)In your Heroku dashboard, under the Deployment Method section, you'll see the GitHub logo w/ a button "Connect to GitHub". You'll follow the prompts, sign in to GitHub, and be all set. Now, when you push new code up to GitHub, it will update your Heroku app as well.&lt;/p&gt;

&lt;p&gt;Note: Your local database and your Heroku database are not the same. In order to make changes to the Heroku database. you have to preface your &lt;code&gt;rails db:&lt;/code&gt; commands with &lt;code&gt;heroku run&lt;/code&gt;. Ex. &lt;code&gt;heroku run rails db:rollback&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Checkout your fresh API, deployed on the web!
&lt;/h3&gt;

&lt;p&gt;Use the "Open App" button in your dashboard's top right corner.&lt;/p&gt;

&lt;p&gt;Note: Make sure you've specified a route. If you don't have a "/" homepage GET route, &lt;a href="https://app-name.herokuapp.com"&gt;https://app-name.herokuapp.com&lt;/a&gt; gives a message that the page can't be found. &lt;a href="https://app-name.herokuapp.com/users"&gt;https://app-name.herokuapp.com/users&lt;/a&gt; for example will be what you want.&lt;/p&gt;

&lt;h2&gt;
  
  
  Returning Users
&lt;/h2&gt;

&lt;p&gt;1) Log back into Heroku and create a new app by adding your app's name and region.&lt;/p&gt;

&lt;p&gt;2) In your backend's root directory, run &lt;code&gt;heroku login&lt;/code&gt; and login as prompted.&lt;/p&gt;

&lt;p&gt;3) If the repo is a git repository, run &lt;code&gt;heroku git:remote -a &amp;lt;app_name&amp;gt;&lt;/code&gt;. The app name must be the same as the name you used on Heroku.&lt;/p&gt;

&lt;p&gt;4) Change your database from its default, SQLite3 to PostreSQL&lt;br&gt;
Note: If you've yet to create your Rails backend, you can initialize it with a PostgreSQL database using &lt;code&gt;--database=postgresql&lt;/code&gt; or &lt;code&gt;-d=postgresql&lt;/code&gt; e.g. &lt;code&gt;rails new &amp;lt;app_name&amp;gt; --api -d=postgresql&lt;/code&gt; and skip these next steps.&lt;/p&gt;

&lt;p&gt;Another note: If you have information in your database that should not be deleted, MIGRATE entries before continuing. I found an article that looks helpful &lt;a href="https://tutorialinux.com/today-learned-migrating-sqlite-postgres-easy-sequel/"&gt;here&lt;/a&gt;(although I haven't needed to do this so take the recommendation with a grain of salt!).&lt;/p&gt;

&lt;p&gt;First, go to Rails Gemfile. Edit lines 8 and 9 from SQLite3 to &lt;code&gt;# Use postgresql as the database for Active Record&lt;br&gt;
 gem 'pg'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, in config/database.yml, delete all commented-out code having to do with Sqlite3 (Heroku won’t like it). Change the default adapter to &lt;code&gt;postgresql&lt;/code&gt;, and the development database, test database, and production database to &lt;code&gt;app_name_development&lt;/code&gt;, &lt;code&gt;app_name_test&lt;/code&gt;, and &lt;code&gt;app_name_production&lt;/code&gt; respectively.&lt;/p&gt;

&lt;p&gt;Delete Gemfile.lock (&lt;code&gt;rm Gemfile.lock&lt;/code&gt;). Then run &lt;code&gt;bundle install&lt;/code&gt;. This will recreate your Gemfile AND delete your old SQLite3 database(s).&lt;/p&gt;

&lt;p&gt;Then run &lt;code&gt;rails db:create&lt;/code&gt; and to create your new development and test databases. Run &lt;code&gt;rails db:migrate&lt;/code&gt; and &lt;code&gt;heroku run rails db:migrate&lt;/code&gt; to create your tables locally and on Heroku. Check here to make sure everything looks good before moving on.&lt;br&gt;
If you have seeds, at this point you can run &lt;code&gt;rails db:seed&lt;/code&gt; and &lt;code&gt;heroku run rails db:seed&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Lastly, add and commit these changes to git. If you haven't synced Heroku with your Github, run &lt;code&gt;git push heroku master&lt;/code&gt;. Note: this command won't run unless you installed Heroku as listed in the steps above.&lt;/p&gt;

&lt;p&gt;5) Sync Heroku w/ Github&lt;/p&gt;

&lt;p&gt;If you have a GitHub repo that you'd like to link to Heroku, it's super easy. In your Heroku dashboard, under the Deployment Method section, you'll see the GitHub logo w/ a button "Connect to GitHub". Follow the prompts, sign in to GitHub, and you're all set! When you push new code up to GitHub, it will update your Heroku app as well.&lt;/p&gt;

&lt;p&gt;Note: Remember that your local database and your Heroku database are not the same. To make changes to the Heroku database, preface your &lt;code&gt;rails db:&lt;/code&gt; commands with &lt;code&gt;heroku run&lt;/code&gt;. Ex. &lt;code&gt;heroku run rails db:rollback&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Debugging Tip
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;heroku logs --tail&lt;/code&gt; will open up a server that logs requests to your Heroku backend. You can even use &lt;code&gt;heroku run rails c&lt;/code&gt; to check User.all, etc.&lt;/p&gt;

&lt;p&gt;Happy coding! :)&lt;/p&gt;

</description>
      <category>heroku</category>
      <category>rails</category>
      <category>api</category>
      <category>deployment</category>
    </item>
    <item>
      <title>Creating a dynamic selection list with TTY-Prompt</title>
      <dc:creator>ljg2gb</dc:creator>
      <pubDate>Mon, 29 Jun 2020 14:17:07 +0000</pubDate>
      <link>https://dev.to/ljg2gb/creating-a-dynamic-selection-list-with-tty-prompt-2ea3</link>
      <guid>https://dev.to/ljg2gb/creating-a-dynamic-selection-list-with-tty-prompt-2ea3</guid>
      <description>&lt;p&gt;When writing a CLI application there are some Ruby gems out there that make a big difference. TTY-prompt is without a doubt one of the most popular CLI gems out there - and for good reason. TTY-prompt is extremely helpful for reducing user error which makes your code harder to break since the user is no longer typing directly into the command line to make a selection. And, I think, improves the user experience which is important even in a small-scale application like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IOmx0tSP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/o8k75r8t5sw67hoi3hk0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IOmx0tSP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/o8k75r8t5sw67hoi3hk0.png" alt="example of tty-prompt in action"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basically, the TTY-prompt gem works by reformatting the output to let the user scroll through a list of options and make a selection. Here is a classic example of the TTY-prompt in action:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--re4ot95X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/txfnewidemyynw9v71ko.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--re4ot95X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/txfnewidemyynw9v71ko.png" alt="Statically coded example that you will find in the documentation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, if your app is like mine you’ll need these lists to be dynamic. If your seed data changes, or if the selection list is determined by user input, you’ll code that’s more flexible than the examples given to you in the TTY-prompt documentation, that looks a lot like the main-menu example above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a dynamic list with TTY-prompt:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zTNDgJ3U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/c1724iuayhorm0hc0sgq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zTNDgJ3U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/c1724iuayhorm0hc0sgq.png" alt="Dynamically coded tty prompt examples"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My partner and I managed it by splitting it up into three methods:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a dynamic method that returns the selections you want to display like “list_farm_names.”&lt;/li&gt;
&lt;li&gt;Create a method that displays the selections using TTY-prompt like “print_farm_name_list.”&lt;/li&gt;
&lt;li&gt;Create a method that returns the selected information like “farm_selection(selection).” This will look different depending on what data you are returning and how your schema is set up. In our example, we wanted to return the farm’s website URL if one existed, a list of available products at that farm, and the quantity.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ttyprompt</category>
      <category>dynamicprogramming</category>
      <category>cliapp</category>
      <category>ruby</category>
    </item>
  </channel>
</rss>
