Chris Oliver

Joined

291,200 Experience
86 Lessons Completed
299 Questions Solved

Activity

The SyntaxHighlightFilter depends upon github-linguist that depends upon pygments.rb so behind the scenes you'll be using the same tools. :)

Posted in Rails 4.0 with MongoDB and Mongoid Discussion

That's up to you to make sure you've got a project that's worth using with it. There are lots of good articles on it that you can check out:

http://java.dzone.com/artic...
http://docs.mongodb.org/eco...
http://www.sarahmei.com/blo...

Posted in rbenv: bundle: command not found

I'm not really sure how much faster (if any) it is. I do think it's probably going to be faster and it used to be in the tutorial but I'm not sure when it went missing.

I need to experiment with a "submit an improvement" piece to the guides so that people like you can make improvements and I can quickly review the diff and merge them in.

Posted in Show each users each post.

So you'll need a join table between Movies and Users. Something like UserMovie is a standard naming scheme for that. You could also give them a name like Favorite.

In essence you'll do this:

class User < ActiveRecord::Base
  has_many :user_movies
  has_many :movies, through: :user_movies
end

class UserMovie < ActiveRecord::Base
  belongs_to :movie
  belongs_to :user
end

class Movie < ActiveRecord::Base
  has_many :user_movies
  has_many :users, through: :user_movies
end

This lets you access @user.movies to get their movies and you can also get a list of a movie's users (people who favorited it for example) by doing @movie.users

You will need some mechanism to create the join table records, but if you check out the screencast I did on hearts/favoriting/liking, that's pretty much exactly what you'll be doing for that.

It depends on the type of JOIN you do. There's a bunch of different ways to do it, but take a look at this. It's one of the better things out there to explain the different JOINs. http://blog.codinghorror.co...

Posted in Sending Data Between Controllers And Views | GoRails

3 months later isn't bad on the internet these days. ;-)

Posted in Setup MacOS 10.9 Mavericks Discussion

Always something! It looks like you've got something configured to point to that directory so maybe you set an environment variable while following one of those posts. That's definitely possible. You might need to just unset some environment variables then.

Posted in Setup MacOS 10.9 Mavericks Discussion

One thing to keep in mind, at least with OSX, if you can install it with Homebrew, definitely do that. It's easily the best way to install things and you rarely will have trouble with it.

Posted in Setup MacOS 10.9 Mavericks Discussion

You should just be able to do bundle install without any options and it should work.

Now that I'm looking at your logs again, it looks like you installed Postgres.app so it isn't looking at homebrew's Postgres. I'm sure that's the problem. One thing you can try is to uninstall Postgres.app and see if it gets resolved.

If you want to keep with that Postgres.app, there is lots of people talking about it with some instructinos that probably work: http://stackoverflow.com/qu...

Posted in Capistrano deploy removes tables from database.

So every time you deploy with capistrano, it creates a new folder for the "release". This means all the files that were created in the previous directory (like your sqlite database for example) will be in that old folder. Your restart will happen and it will then serve up only from the new directory. Your database still exists, but it is in a different folder that isn't accessible anymore!

This is why you want to use a shared database of some sort in production. You can move this production.sqlite3 file to the shared folder and then put it in your linked_files option just like you did with database.yml and secrets.yml. This way you'll only have one copy of the sqlite3 database file and it will get linked into the app each time. Same goes for the database.yml and secrets.yml files. You only have one, and it creates a link to it on deploy so your Rails app can access it.

Posted in could not connect to database postgres

It sounds like postgres isn't running. There is a ton of information on managing it from here https://help.ubuntu.com/community/PostgreSQL

Posted in Setup MacOS 10.9 Mavericks Discussion

I think you may need to install postgres because it can't find libpq in your logs there: Can't find the PostgreSQL client library (libpq)

brew install postgresql

Also with this set up, you should never have to use the sudo command. If you use it, you're likely to cause permissions problems where files are owned by root and not your user. It causes a chain effect where everything starts to require sudo which is bad. Basically don't ever run sudo and if you run into problems, there's a different problem which can be fixed without sudo. :)

Posted in Setup MacOS 10.9 Mavericks Discussion

You need to run 'bundle install' as it mentioned there. You set up a new Rails app with a different database. That means you've got a new database adapter gem to use but haven't installed it yet. bundle install will do that for you.

Posted in Getting a 403 on Ubuntu + Nginx

So if it doesn't find the file, Nginx will hand it off to Passenger to try the Rails app. One thing that could be a problem is if your movieseat directory is owned by root or another user that doesn't have access to the directory. That would cause that error.

What's the output of:

ls -la /home/deploy/movieseat/current/

Posted in rbenv: bundle: command not found

I'd check your /var/log/nginx/error.log file for details.

Posted in rbenv: bundle: command not found

Those two lines were more notes of mine that you should set passenger_ruby differently if you built Ruby from source vs rv vs rbenv. You just choose which line is relevant to you. In this case since you are using rbenv, you can ignore the lines that don't have .rbenv in the folder name.

The instructions for installing Node seem to have gone missing. I ran into that yesterday too while building up a new Droplet myself. Also need some sprucing up of the database.yml + secrets.yml.

For both of those, start deploying, let it fail, and when it says it couldn't find database.yml, just ssh into the server, visit /home/deploy/myapp/shared/config and type vim database.yml and write your production database config in their. You want to keep these files only on production for security reasons. You'll do the same thing with secrets.yml and put it in your linked_files in config/deploy.rb inside your app if you're using Rails 4.

Posted in Using Vagrant for Rails Development Discussion

You might check this out http://spin.atomicobject.co...

Posted in rbenv: bundle: command not found

You should be able to find a file in the /var/log/nginx directory that will give you more details on what's going wrong. That looks right, but could be a handful of things that might cause the 403 Forbidden. There's usually an error.log file in there that will tell you if it can't find the directory or whatever else might be the case.

Posted in rbenv: bundle: command not found

Your ~/.bashrc file looks correct. It seems everything is loading rbenv as expected.

I believe you should just be able to say gem install bundler on the VPS now because the gem command will come from rbenv and install bundler inside of rbenv appropriately. After that, your Capistrano deploys should work using that version of bundler.

Posted in rbenv: bundle: command not found

That was an example from my local machine but you will want the same results on your server user.

One thing you might double check is that rbenv is being loaded in your ~/.bashrc file properly. I think it is, but that could be why it isn't using the right gem/bundler commands.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.