Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

chris salvi
chris salvi
7,584 Points

deployment of rails app on heroku not working

so close to finishing this arduous lesson, but I keep receiving an error on the gem file page

photos:

Code:

http://postimg.org/image/k2iaggm2f/

Error:

http://postimg.org/image/sfqs0p7ll/

chris salvi
chris salvi
7,584 Points

ok ignore previous comment as video covers it, but now my 'deployed' app has lost all of the styling and Im flummoxed

http://postimg.org/image/n74ap198j/

David O' Rojo
David O' Rojo
11,050 Points

Have you checked if the branch you're deploying does include the style assets properly?

chris salvi
chris salvi
7,584 Points

how would I check this? I had the stylesheets working fine when I had it running on the local host, but now it's devoid of anything bootstrap or css related.

3 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

Chris, here's the deployment I made:

http://mighty-atoll-1486.herokuapp.com/

Let me know if it looks like you intended (styles) and I will tell you what I did exactly.

chris salvi
chris salvi
7,584 Points

Well, this is much further than I got in terms with the styling, so Im all ears about how to hear you got it hosted.

A couple questions that I couldnt seem to manipulate with CSS:

  1. how do I get the grey hover over all statuses to only focus on the text area and not just the entire length of the page?

  2. how do I remove the bullet point next to the login

  3. How can I make the Register & Login in-lined instead of vertically stacked?

Like I said I tried to manipulate this all with css but it was acting wonky or unresponsive.

chris salvi
chris salvi
7,584 Points

I cant even get my rails working because of the gem installs I did

Heres the error:

An error occurred while installing pg (0.17.1), and Bundler cannot continue. Make sure that gem install pg -v '0.17.1' succeeds before bundling. chriss-mbp:treebook salvi$

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

OK, step by step:

I changed the Gemfile:

source 'https://rubygems.org'

gem 'rails', '4.1.4'
gem 'devise'
gem 'simple_form'

group :development, :test do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'spring',        group: :development

ruby "2.1.2"

I added this to the .gitignore file:

/config/database.yml
database.yml
config/database.yml

This is crucial. You have to make Git ignore the whole database.yml file so that it doesn't go to GitHub or Heroku - Heroku will generate its own file then, configured properly. This would require you to temporarily delete that file from the directory, delete it from Git in a new commit (google how to do it properly, there are some differences in how versions of git handle this) and then just add it back manually, but Git will no longer see it thanks to gitignore. Alternatively you can leave it be and just edit it a bit in the production section in accordance with Heroku's tutorial.

Run bundle install --without production (or --without=production) to get the new Gemfile.lock, add and commit all changes, run heroku create, run git push heroku master, and finally run heroku run rake db:migrate.

This should not require you to install the pg gem at all and Heroku will take care of the rest.

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

And now for your CSS problems:

1) I think you would need to use jQuery for this. In CSS you always apply the style to the whole thing you are targeting and with jQuery you can traverse to siblings, children, parents etc. of the thing you are targeting.

2) You're looking for this in ul tag style (make sure it's in the last loaded css file): ul { list-style-type: none; }

http://www.w3schools.com/cssref/pr_list-style-type.asp

3) This should help: li { display: inline; }

http://www.w3schools.com/css/css_navbar.asp

chris salvi
chris salvi
7,584 Points

I am nominating you for polish sainthood. You are the best!

chris salvi
chris salvi
7,584 Points

I bet you're really looking forward to my next slate of desperate posts as I tackle the intermediate add friends challenge hahaha

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

Well, this would actually force me to get through these videos myself and learn how it works (I never did), so yeah, I kinda do ;)

chris salvi
chris salvi
7,584 Points

do you have any recommendations on what to read to get a better idea of Rails 4? I think Im only learning a superficial level from the videos unlike with the javascript or html css lessons. I am very comfortable manipulating the dom and styling normally, but it gets complicated with rails because of how much intersection interaction there is between languages.

chris salvi
chris salvi
7,584 Points

I say we forge a little alliance across the great wide sea and work on it together Maciej! I have been already documenting all the errors I made and your help from the first lesson, and it would be fun to continue on and discover making these features work in Rails together!

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

Sure, I would love to :). I used to have a code buddy once, but he no longer has time to work with me. The only helpful thing that comes to my mind right now are RailsApps and Pragmatic Rails 4 book.

David O' Rojo
David O' Rojo
11,050 Points

Check your browser's developer tools to see if there is the styles are included or if there is an error loading the file. If there is no error but still there are no styles, it may be that the branch you're working on locally is different from the one youŕe deploying.

Git by default will push the master branch to Heroku, so if you're use other branch (check with git status), you need to merge your changes into master or explicitly tell git to push the branch you're on to Heroku.

Merging branches

   git checkout master
   git merge your_branch_name

Pushing a branch different to master to Heroku

   git push heroku your_branch:master
chris salvi
chris salvi
7,584 Points

I am using the master branch, and I dont see any errors in the terminal.

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

In most cases there's just problem with glyphicons. Google out how to prcompile assets for production environments, commit that and try deploying again.

chris salvi
chris salvi
7,584 Points

ok it says that I need to run a install bundle, but when I do that it says the following:

http://postimg.org/image/rb05wkwkj/

I tried to execute the

sudo gem install pg -v '0.17.1' but it threw an error, as is want these days :(

This seems to be necessary in order for me to procompile the assets according to stack overflow.

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

OK, did you follow the current step-by-step the instructions heroku published for your version of Rails?

chris salvi
chris salvi
7,584 Points

no, but I did follow the video steps to a T. I did manage to get something up on the internet, just not with the style.

chris salvi
chris salvi
7,584 Points

I went through the documentation Maciej but did not find anything helpful. If you dont mind taking a look at my github account this weekend to find whats wrong I would appreciate it.

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

Sure. Just give me the link again. I will try to deploy it myself and see what happens.

chris salvi
chris salvi
7,584 Points

https://github.com/donsalvadori

I also just had my interview on skype today with hack reactor, which could have gone better. I forgot how to use higher order fx in context of a previously written function implemented into a new sort function, but such is life. I gave it my best and hope that my github activity spares me any detraction from the tech interview.