So I’m back in JavaScript world again. Since I had done a lot of the intro stuff during my Bootcamp Prep work I spent tonight mostly skimming over everything I already had done to remind my mind how to think JS. I have to say, it didn’t come back quickly when I was reading it. The first lab I worked on, well the only lab I worked on, was slow. However, the functions and syntax came quickly. I feel good now that I’m done for the night. Like my brain is back to JS somewhat. I didn’t get the lab completed which was a bummer. I can look at how simple it is and know that I would have finished it in the same amount of time in Ruby but that’s fine. It’ll come quickly. The biggest thing is I know how to solve these problems better now. I just need to find equivalent functions in JS to get done what I need.

One thing I spent some time on was figuring out how to access a local “JS playground” in the terminal. It’s just easier to hit a key combo and pop into the terminal in my IDE and test than to switch over to the browser. It took asking and some searching but I finally came up with running node to bring up a repl (pretty sure I can’t explain this so read the Wikipedia and be more confused). Also, to exit out of it process.exit() is used. This was a nice find because I was spoiled by IRB, Pry, byebug and such in Ruby.

I didn’t technically finish any lessons tonight but I felt like I got a lot done.

Time spent today: 2:23
Time spent total: 323:28
Lessons completed today: 0
Lessons completed total: 519

I tidied up my app today. I decided to scrub the DB and run a new set of seeds then test everything as best I could. This is where I see automated testing is very useful. I really want to get better acquainted with writing tests. However, I also want to finish this curriculum so I can stop paying tuition. I’m slowly building out my testing resources to take a deeper dive into that once I’m done with Flatiron. I think having high code coverage for my projects will make them more impressive to employers. I know TDD is a key thing being done these days so demonstrating I understand how to do it will be a nice touch.

So I just spent about an hour integrating Travis CI and Coveralls into my app. I’m not really sure how Coveralls decides the coverage but apparently, I have 90% coverage with only 4 tests lol. I bet I can get that up higher. I DO want to finish writing tests for my models at least. I don’t think I’ll delve into Capybara testing at all for this. I think some comprehensive model tests will be a good start. I asked in NashDev #javascript about JS testing tools and a lot of people mentioned Jest although it doesn’t do browser testing. was mentioned favorably as well although it appears to be in closed beta. This looked really interesting to me. Also for browser testing Selenium and TestCafe were thrown into the conversation. TestCafe looks cool but It’s also $500 so it better be good haha. I applied to get early access to Cypress so we’ll see how that goes.

Take a look at my app here and leave a comment with bugs, comments or suggestions, please.

Time spent today: 3:57
Time spent total: 321:05
Lessons completed today: 1
Lessons completed total: 519


My Rails project is officially done! Well, it officially fulfills all the requirements that Flatiron School has for it. I definitely have more to do with it. However, considering that I’m done almost a day and a half before my self-set deadline I’m happy. Some minor things in my views (like showing just a user’s items instead of all items), building out a more robust navbar, filling out my readme, and I should be good. I also want to change my Oauth login into a button with a logo on it. I’m trying to no code “raw” HTML but I’ll probably end up doing it for that. Using Font Awesome and Bootstrap inside and ERB tag is just a pain haha.

My largest hangup was my nested forms and getting them to work properly. Although, I felt better this morning when I reached out to a public Ruby Slack room and a guy who’s a boot camp instructor (not at Flatiron where I attend) said,

yeah, that’s the worst. Dealing with nested forms is always something I have to go back and read the manual on.

I felt a lot better about the struggle life.

Check out the repo here. I’ll share the link tomorrow when I get it deployed (hopefully). I’m hoping that deploying is more straightforward since I used PostgreSQL. Not sure how well dotenv is going to play with Heroku. I know others said Figaro made it dead simple to deploy with so I might do that if I hit any snags. I wish I had more to talk about with my process but I think it’s all there is the 100+ commits lol. That and I have tacos waiting for me as soon as I finish this blog post up, get it posted, link to it on my project page, and officially submit my project.

It feels good to be at this point. Even if a little surreal at how far I’ve come in <3 months.

Time spent today: 8:27
Time spent total: 317:08
Lessons completed today: 1
Lessons completed total: 519

I’m stuck. It’s no fun. I still have things to try but I’ve hit a wall. It’s to be expected and the nested form I’m working on is by no means a simple thing. However, this is basically the BIG problem in this project. In my opinion, at least this is the hardest part of this project.

Include a nested form writing to an associated model using a custom attribute writer (form URL, model name e.g. /recipe/new, Item)

This requirement is the big one IMO. Actually, why not show off the spec and see what others think. Is this a strong project?

### Specifications for the Rails Assessment

– [x] Using Ruby on Rails for the project
– [x] Include at least one has_many relationship (x has_many y e.g. User has_many Recipes)
– [x] Include at least one belongs_to relationship (x belongs_to y e.g. Post belongs_to User)
– [x] Include at least one has_many through relationship (x has_many y through z e.g. Recipe has_many Items through Ingredients)
– [x] The “through” part of the has_many through includes at least one user submittable attribute (attribute_name e.g. ingredients.quantity)
– [x] Include reasonable validations for simple model objects (list of model objects with validations e.g. User, Recipe, Ingredient, Item)
– [ ] Include a class level ActiveRecord scope method (model object & class method name and URL to see the working feature e.g. User.most_recipes URL: /users/most_recipes)
– [ ] Include a nested form writing to an associated model using a custom attribute writer (form URL, model name e.g. /recipe/new, Item)
– [x] Include signup (how e.g. Devise)
– [x] Include login (how e.g. Devise)
– [x] Include logout (how e.g. Devise)
– [x] Include third party signup/login (how e.g. Devise/OmniAuth)
– [ ] Include nested resource show or index (URL e.g. users/2/recipes)
– [ ] Include nested resource “new” form (URL e.g. recipes/1/ingredients)
– [ ] Include form display of validation errors (form URL e.g. /recipes/new)

– [ ] The application is pretty DRY
– [ ] Limited logic in controllers
– [ ] Views use helper methods if appropriate
– [ ] Views use partials if appropriate

That’s what I have checked off as well so far. I’m pretty far along and once I nail this nested form part I think the rest will be easier. If memory serves me correctly the nested show/index/new is accomplished through my routes so that isn’t even too complex. I already have an idea for my class level scope method. Then form errors being displayed. Hopefully, I can solve this nested form early tomorrow afternoon and be past it. The interesting thing is my associated model is writing just fine and it’s the “parent” that isn’t creating. I might just go back and comment out the nested part and just get the basic form to work correctly first. Actually, that’s exactly what I’m going to do. Not sure why I didn’t, to begin with. I’m just trying to get too much accomplished at once.

Okay, now I have my plan of action for tomorrow which makes me happy.

I also plan to completely redo my personal site and install Ghost on it. I discovered today that I can install Ghost via cPanel on my web host. BTW, I absolutely love my web host and you should check them out… GeekGhost. I switched to them because they support Let’s Encrypt and a lot of the large hosts do not because they want you to buy SSL certs from them. Might move my GitHub Pages site over to that as well. Create a unified site for myself since I currently have stuff all over the place. We’ll see.

Time spent today: 1:45
Time spent total: 308:41
Lessons completed today: 0
Lessons completed total: 518

Today was productive. I was able to create a more in-depth TODO file during the day while I was watching my kiddos. This allowed me to think more about how my app was going to function and what I needed/wanted to build into it. It provided me with a better workflow for the evening. I knew exactly what I would be working on tonight. Even if I did get sidetracked a couple times while working it was still always productive. Granted a lot is going into making the app look better than a default Bootstrap install. I got Omniauth through Devise up and running tonight smoothly by following the docs. The only snag I hit for a quick minute was in my using of dotenv.

# First try
config.omniauth :facebook, FB_APP_ID, FB_APP_SECRET

# Second try
config.omniauth :facebook, 'FB_APP_ID', 'FB_APP_SECRET'

# Third and correct try
config.omniauth :facebook, ENV['FB_APP_ID'], ENV['FB_APP_SECRET']

This was pretty easy to troubleshoot. The first try threw an error. The second try had FB_APP_ID in my Oauth URL telling me that the string was being passed (makes sense). Then one more reading of the docs and I got the correct implementation.

I also had to figure out how to render a proper looking Bootstrap button as a link using Rails helpers. Okay, I didn’t have to but I wanted to. After playing around for a bit I decided on this code:
<%= button_to 'Add Your First Place', new_place_path, class: 'btn btn-primary', method: :get %>
Which isn’t the prettiest but is getting the job done correctly. I want to add a Font Awesome icon inside the button and I think to do that I’ll have to pass a block in. I’m going to work on that tomorrow though. It’ll be a useful thing to figure out so I can stylize the OAuth login buttons better. The one I have right now is currently just a text link. We all know that’s no fun.

I also went to a meetup tonight where the presenter talked about Elm. It’s a functional language which is definitely different. However, the presenter said that he felt Elm was a great starter to learn a functional language. I’ll probably look into this when I finally have some free time after I’m done with Flatiron. Elixir is of interest but it might be too big of a jump to start. We’ll see. I could possibly also keep building things in the languages I’m learning to show more mastery of those until I land my first gig then start branching off. Another one out there is Hanami built on Ruby which I’ve heard is pretty cool and built more like other frameworks and libraries than Rails. That might be the next logical step. There’s just so much knowing what to do next is a research project in its own right. I look forward to it though.

My newest obsession which I learned at the meetup tonight is leading commas:

new_person = { name: "Seth"
  , age: 32
  , height: 74
  , weight: 155
  , alive: true

I’ll just leave that there.

Time spent today: 2:19
Time spent total: 306:57
Lessons completed today: 0
Lessons completed total: 518

Man, it’s hard keeping track of all the tools I’m using as I’m building out this app. I’m finding the biggest thing I’m focusing on right now is getting Devise to look nice by customizing the views and implementing Bootstrap 4. One thing I had to work on was updating the strong params in Devise so my User could register with a name. That wasn’t too tricky although I’m implementing it “the lazy way™” which I’m okay with for now.

I also updated my messages with a better implementation from the Devise docs here. The one thing that didn’t take into account is that when implementing the Bootstrap 4 gem docs specifically say:

Then, remove all the *= require and *= require_tree statements from the Sass file. Instead, use @import to import Sass files.

Do not use *= require in Sass or your other stylesheets will not be able to access the Bootstrap mixins and variables.

So my custom.css.scss was not loading. A quick tour of the Asset Pipeline and I got it working. However, now looking back and writing this I need to utilize @import instead of how I did it using *= require custom.css.scss in my application.scss file. Boom done.

@import "custom.css.scss";
@import "bootstrap";

I’ve accomplished more than I thought I had when I went through the spec provided by Flatiron and started checking things off. I think I can still be finished by Sunday night. I actually think it’s not as hard as I was making it fulfill the requirements. Considering the things they’ve taught us I would expect there to be some sort of roles integration or something but there wasn’t. I do want to build something that utilizes Pundit, however, this app isn’t the right fit for that. I’ll figure something out so I have some things to do when I’m done with the program while I job search.

Okay, it’s late. Until tomorrow.

Time spent today: 3:01
Time spent total: 304:38
Lessons completed today: 0
Lessons completed total: 518

I didn’t get much done yesterday so I ended up not writing. I did figure out an app to build for my project. However, I wasn’t able to get much done in the way of getting started. I won’t get into it, but, I was frustrated with last night.

Tonight has been better. I’m making progress setting the base of the app up. It took a little bit to figure out how to setup PostgreSQL. I’m not sure I could tell anybody else how to do it but I got it working. I did this because when I deploy I plan to have my app on Heroku. Heroku doesn’t support SQLite but does support PostgreSQL. I figured this would save deployment headaches. We’ll see. I think I have all the gems I’ll need, except Devise Omniauth stuff. I figured I can have that on a TODO for later. Or even after I pass my assessment. I’ve started keeping my TODO though which is good. I’ll be able to better keep track of the things I want to implement even if I don’t do it for my assessment. I also got Bootstrap 4 loaded up and ready so I can make everything prettier when I’m done.

I’m trying to be more organized in how I keep track of things and plan my projects. I know as they get more complex this will be an important step. Hence, the DB wireframe I did. It’s not super complex but I’m going to fill it out more than I did with my Sinatra project.

I have an idea for another app and will have to decide when to build that out. I don’t think it would have hit all the requirements for this project so I didn’t want to start it then have to force it so to speak to get it to fit. So what am I building? Basically a personal review site for food and beverage items. You’ll be able to keep track of things you like and dislike at places.

Random side note. I downloaded Opera again for the first time in forever after reading “Friendship Ended With CHROME Now OPERA Is My Best Friend”. Specifically the fact that Opera is built on the same engine as Chrome, Blink. Thus it renders pages almost the exact same way. In fact, it even has the same keyboard shortcuts (as far as I can tell) and dev tools.

Time spent today: 3:30
Time spent total: 301:37
Lessons completed today: 0
Lessons completed total: 518