Project:
https://github.com/jmopr/job-hunter
Background:
Took only 2 intro course on Java 7 years ago.
So I was browsing GitHub and ran across this nifty project that deals with scraping & applying for jobs on indeed.com.
The question is, how do you run it? Here is what I tried to do:
Tried to execute applier.ru I figured I was doing something wrong after getting:
/home/shap/Desktop/job-hunter-master/applier.rb:19:in initialize': uninitialized constant JobApplier::Job (NameError)
from /home/shap/Desktop/job-hunter-master/applier.rb:169:innew'
from /home/shap/Desktop/job-hunter-master/applier.rb:169:in `'
Something was missing, so looking around I found the bin folder and tried executing /bin/setup.ru but i ran into this error:
== Preparing database ==
/var/lib/gems/2.3.0/gems/railties-4.2.5.1/lib/rails/application/configuration.rb:110:in database_configuration': Cannot loadRails.application.database_configuration`:
Could not load database configuration. No such file - ["config/database.yml"] (RuntimeError)
Are we supposed to generate our own database file? how would we do that?
Any help or even a push in the right path is deeply appreciated.
You are supposed to generate your own database configuration. It should be stored at config/database.yml. It's a file that specify where's your db server, what's the name of the database and what should be the credentials to access it. Google "rails database.yml example".
Once you have that, creating your actual database is as easy as running these commands
rake db:create
rake db:migrate
There may be many-many other different obstacles on your journey of making this application run. Things that are obvious to rails devs, but arcane to total strangers. I suggest finding and completing a ruby on rails tutorial.
This is ruby on rails project,
after checkout you need install all required dependencies, with command
bundle exec install
Run project you can with command
./bin/rails server
If project is started successful, you can access it with browser using address http://localhost:3000
more about rails you can find there http://guides.rubyonrails.org/getting_started.html
http://guides.rubyonrails.org/getting_started.html
Related
Im following a rails tutorial, and when im supposed to run the command: 'bin/rails generate model Article'. An error occurs saying that there isnt such a command.
I'm using 'command prompt with ruby on rails' and in the rails project i can find a Bin folder. Am also using windows 7.
Also What is the difference between running only 'rails generate' instead of running 'bin/rails generate'?
Using rails generate is fine if you have no bin stubs (binaries in the root /bin folder of your project). If you do have bin stubs then it's preferred to use them because they may do additional things specific to your project. But even then, it's (probably) fine to just use rails generate still. The other bin stubs may be a little more necessary to use, though (again, if present) because they tend to be shortcuts to e.g. bundle exec rake.
Rails 4.1 ships with bin stubs. That is, when you generate a Rails 4.1 project it generates bin stubs for you. So this is probably why your tutorial mentioned using them -- they're now there by default. But if you're on an older version of Rails that won't help you much.
The big reason Rails 4.1 includes bin stubs is because Rails uses spring by default now. Spring is an application preloader... that makes it so that when you call e.g. bin/rake ... it will load and keep a running rails environment in the background and then, the 2nd time you call bin/rake it will fork from the running environment giving you almost instantaneous response. So this is an example of "additional things specific to your project" that you get from using bin/rake over just rake and bin/rails over just rails.
I'm brand new to Rails and am following this tutorial on how to make Rails applications. I can't get the database to migrate to my heroku apps.
I'm currently at the beginning of chapter 3, trying to set up an app to use for the rest of the course.
I've been following the tutorial perfectly, and, so far, I've already built two apps and deployed them to heroku and migrated the data just fine, but the third time it's not working.
I was able to make the heroku page and push the app to it, but I just can't migrate the data.
I typed:
heroku run rake db:migrate
and got this error:
/usr/bin/env: ruby.exe: No such file or directory.
I'm assuming this means it's looking for the file in that directory and not finding it. How do I change where it's looking?
I checked "windows heroku run rake db:migrate error “/usr/bin/env: ruby.exe: No such file or directory”" and did what the answers recommended, that is, change "ruby.exe" to "ruby" in bin/bundle, bin/rails, and bin/rake, but that didn't work.
Any other tips? I have been stuck on this for hours. Thank you so much in advance.
The command is normally heroku run rake db:migrate. You should try that instead of heroku run rails db:migrate.
Make sure you've pushed your app to heroku. When it's pushing to heroku, make sure that it is also detected as a rails app. It's possible that heroku isn't detecting a rails app so the environment it sets up doesn't have ruby installed. But it may just be the error in the command name (rails instead of rake).
I had a similar problem on a repository I had ported over from windows.
It turns out that several scripts in the app's bin directory still had a shebang lines (#!/usr/bin/env ruby.exe) to ruby.exe instead of ruby. Once I fixed these scripts the problem went away.
On your local dev machine, before committing to git (and then pushing to Heroku), try changing the line endings to Unix line endings (rather than Windows line endings). On a *nix machine you'd do that by running dos2unix myfile.rb
If the line endings are wrong, the Linux loaded on Heroku will look for ruby^M and not for ruby, and will of course not find it, and give this exact error message.
I'm trying to deploy my first app with rails. I'm unable to deploy it, and I'm unhappy because the framework itself allowed me to develop really quickly the application, but I've only two days to make the deployment work :-(
I've installed and configured passenger following a tutorial (i'm using RVM).
When I access the page I have the following error page: traceback here (posted on pastebin to keep this post clear).
What is wrong?
i just uploaded the whole project on the production server, ran bundle install, rake db:create rake db:migrate and rake db:seed. Am I missing some step?
Why it doesn't run?
Developed using Rails 3.2.3 with Ruby 1.9.3.
Please help me to get it running.
Thanks,
Alex.
I have very little information about your problem but I have and idea what is going on. Check your belongs_to association in your event model if there is a class parameter replace it with class_name.
Here's my problem:
I create a new project: rails new myapp.
Rails applications are by default configured to use a SQLite3 database.
I execute bundle exec rake db:create. It works and the SQLite3 database is created.
I try to create a new model (or anything else related to the database), and get the following error:
/home/dinduks/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/rubygems_integration.rb:147:in block in replace_gem': Please install the postgresql adapter:gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) (LoadError)
When I add a controller and an action, and try to visit it, I get this error:
ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
The complete stack trace can be found here: https://gist.github.com/2717365
The WEBrick server starts obviously without complaining.
I reinstalled Rails, reinstalled Ruby, used another Ruby version, reinstalled RVM... And keep getting the same error.
There is nothing related to PostgreSQL, postgres, pg or pql in my code. Not a single word.
I don't want to do what the exception suggests. I want to understand why I have this error and fix it.
So: Why is Rails asking me to install some Postgres stuff while I don't use Postgres?
Thanks!
The problem was the DATABASE_URL environment variable.
When ActiveRecord finds $DATABASE_URL, it automatically uses its information, and ignores config/database.yml.
Thanks to NARKOZ for pointing this out.
(By the way, I had this environment variable set before I discover foreman, which is a great tool to manage environment variables)
I'm learning rails with "agile web development with rails (3rd edition)" and I've gotten to the point where I'm supposed to make the depot app.
I have created the depot app, and I've added the script/generate files. I've raked the db. For some reason, no tables where created in the migration and upon running this command:
depot> sqlite3 db/development.sqlite3 "select version from schema_migrations"
I get nothing. Then when running localhost in my browser, instead of getting what I'm supposed to, I get the standard welcome to rails page.
Any advice?
Resolved:
It's always the simple things. Had to direct to localhost:3000/products instead of just to localhost:3000 - wasn't aware of this. Thanks!
There is a number of possibilities here, firstly, judging by the fact you can see the standard "Welcome to Rails" page you haven't deleted public/index.html - you should do this so that Rails can route to the root /
Secondly, if your migrations are running correctly you should have a schema.rb file in ./db with the instructions for each table, if not then something is failing there.
I have not read the 'Agile web development with Rails" book but I am assuming it was written before the release of Rails 3, which means your app does not use Bundler for gem dependency management so it might be worth checking that sqlite3 gem is installed. You can check this with gem list sqlite if you don't see something like "sqlite3-ruby (1.3.2)" then you need to install it.
Lastly, check the log files in ./log/
Well I guess you've created multiple migrations by now so try typing rake db:migrate at the command line and let use know what it says?