Am new to rails, just going through a tutorial "learn ruby on rails" Have successfully push files/folders to the github repository.
I want to start the server with rails server to view the default home page of the rails app on my browser but I keep getting a NoMethodError.
I am running the command in my project directory "\projects\Rails\blog>",and i have installed all the required gems with the command "bundle install" after specifying Gem version as giving in the tutorial.
I have configured Rails to connect to email server ("Gmail") also. The error is as shown in the image below.
$ rails new learning #creates a new rails project
$ git remote add origin https://github.com/MY_GITHUB_ACCOUNT/learning.git
$ rails generate figaro:install #To create application.yml file to hold ENVs.
$ git push -u origin master
$ git add -A
$ git commit -m "add configuration"
$ git push
$ rails server
Related
I am trying to get into my rails heroku database. Usually I just run:
heroku run rails console
but it's giving me an error: bash: rails: command not found
I have no idea what caused this. Haven't updated my project code.
heroku --version
heroku-toolbelt/3.36.5 (x86_64-darwin15) ruby/2.2.4
heroku-cli/5.6.14-b0cc983 (darwin-amd64) go1.7.4
=== Installed Plugins
heroku-redis#1.2.8
The same happened to me. My problem was that I didn't commit my changes before the first push, so I didn't have the project up. I did:
git add .
git commit -m "first commit"
git push origin heroku
then, before trying rails c, you need to setup the database.
heroku run rake db:migrate
I followed this devcenter.heroku: getting started with rails4
I am using gem Watir in my web application. When my user triggers an action the watir webdriver is opened and there's scrapping and posting on websites involved. I dont want my users to see the browser during the action so I am using watir with a ghostdriver using phantomJS as is explained here : http://watirmelon.com/2013/02/05/watir-webdriver-with-ghostdriver-on-osx-headless-browser-testing/
This works perfectly locally, however when I try using it on heroku deploy I get the following error:
Selenium::WebDriver::Error::WebDriverError (Unable to find phantomjs executable.):
Then I tried to add nodeJS & phantomJS buildpack as specified here
Is there a working nodejs/phantomjs Heroku buildpack?
I ran the following command line in the console :
➜ tennis-match git:(master) heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs.git --app we-tennis-staging
Buildpack set. Next release on we-tennis-staging will use https://github.com/heroku/heroku-buildpack-nodejs.git.
Run `git push heroku master` to create a new release using this buildpack.
➜ tennis-match git:(master) heroku buildpacks:add --index 1 https://github.com/stomita/heroku-buildpack-phantomjs.git --app we-tennis-staging
Buildpack added. Next release on we-tennis-staging will use:
1. https://github.com/stomita/heroku-buildpack-phantomjs.git
2. https://github.com/heroku/heroku-buildpack-nodejs.git
Run `git push heroku master` to create a new release using these buildpacks.
then pushed on my staging app
➜ tennis-match git:(master) git push staging master
Everything up-to-date
But I still get the error. Do you have any idea on how to fix this ?
This worked for me.
https://gist.github.com/edelpero/9257311
Note: After following the above instructions, make sure you have a Procfile with the code mentioned below:
web: bin/rails server -p $PORT -e $RAILS_ENV
I want to git push to my rails app. I can't seem to find any information about it.
I want my rails app to be something like Heroku in a sense I could git push to it, though obviously building is a whole other matter.
How to be able to git push to rails app?
To Push into git you can follow those steps one after another
$ cd my_project
$ git init
$ git add *
$ git commit -m "My initial commit message"
$ git remote add origin git#example.com:my_project.git
$ git push -u origin master
To Push you rails app to heroku you have to follow the following steps
First install gem heroku
$ gem install heroku
then, Login to heroku with your credentials
$ heroku login
then, Add following gem to your Gemfile
group :production do
gem 'pg'
gem 'rails_12factor'
end
Make sure you add a specific ruby version in your Gemfile, ex: ruby '2.1.2'
run $ bundle install
Create heroku app
$ heroku create
Push to heroku
$ git push heroku master
Run migrations
$ heroku run rake db:migrate
that's it :) Here is a great documentation on heroku page, you can see for more details.
I am trying to upload RoR application to Heroku.
OS - Ubuntu, ruby version - 2.2.2p95, rails version - 4.2.1, database - PostgreSQL, installed RoR via BrightBox (Tutorial from treehouse), using git push heroku master to upload.
On the local server app works fine. When I push it to heroku, it gives out an error:
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
If you are the application owner check the logs for more information.
Log files say:
/usr/bin/env: ruby2.2: No such file or directory
I've tried all the possible variants, I could find on the Internet:
rake rails:update:bin
Remove bin from ~/.gitignore (But there is no such file)
heroku config:set PATH=bin:vendor/bundle/ruby/2.2.2/bin:/usr/local/bin:/usr/bin:/bin
Adding this to the GemFile: ruby '2.2.2'
Changed #!/usr/bin/env ruby2.2(.2 (not sure about ".2")) to #!/usr/bin/env ruby (in bin/rake, bin/bundle and bin/rails)
heroku run rails db:migrate
rake rails:update:bin
ln -s /usr/bin/nodejs /usr/bin/node
To upload to heroku, I've configured git, after that logged in heroku, after that "heroku create", after that "git push heroku master", then "heroku open"
And many others... Any ideas how to solve that problem?
Do you have the gem rails12_factor installed and config.assets.compile = true ?
Not sure you mistyped or something else. but heroku run rails db:migrate will not work it should be heroku run rake db:migrate . It might be because you don't have root page. Precompile issue etc.
Run heroku logs -a app_name to see actual logs.
I haven't been able to get Heroku to update my app for some reason. This is the first app I've had problems with this happening. I've tried a couple different methods, but everything I've tried just says in the command "everything is up to date." and when I check heroku, it's just an early version of my app. Any idea why it won't update on Heroku?
Here is what I've tried:
$ bundle exec rake test
$ git add -A
$ git commit -m "..."
$ git checkout master
$ git merge blah
$ bundle exec rake test
$ git push
$ git push heroku
$ heroku run rake db:migrate
and I've also tried this as well:
$ git status
$ git add .
$ git commit -m "..."
$ git push heroku master
$ heroku run db:migrate
Heres the git status:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Here's trying to force it
$ git push heroku master --force
Everything up-to-date
Here's with git remote -v
heroku https://git.heroku.com/stupidapp1.git (fetch)
heroku https://git.heroku.com/stupidapp1.git (push)
origin https://github.com/Tyrantt47/stupidapp1.git (fetch)
origin https://github.com/Tyrantt47/stupidapp1.git (push)
Curtis, I feel like this answer could be judged as the antithesis of a good dev, but if you have the code you want to deploy checked into version control and locally, why not just push it to a new Heroku app.
If the name of the repository is any indication of the scale of the application, I would say try it and see the results.
Heroku provides good documentation on migrating a database from one app to another and its add-on services are easy to get setup, if either one of those are a concern.
Food for thought...
I think that the syntax is
git push -f heroku master