I'm using user-per-app configuration on an Ubuntu server running ruby 1.9.3 and rails 3.2.8.
When I create a new site using rails new test_app in the home directory of one user (my main user) and then run rails s from the app directory I get
Rails 3.2.8 application starting in development on http://0.0.0.0:3000
but when I su to another user and run the same commands in the home directory of that user, I get
Rails 3.2.8 application starting in production on http://0.0.0.0:3000
and the same thing even if I run
rails s -e development
No matter what I do as the other user, I cannot get WEBrick to start in development. What's going on here?
This must be my day to post Stack Exchange questions and then find the answer myself within moments.
Obviously there was something different about these two users and I just could not figure out what it was. The difference between users ended up being that as the failing user I was playing around with #wayne-e-seguin 's SM framework. The default installation of this sets the environment and RAILS_ENV to production. Setting those to "development" in ~/.smrc did the trick.
Related
I have a 3.2.8 Rails application which has been deployed into production and is running just fine. While preparing to code an enhancement I pulled fresh code from the SVN and started up a development version of the application and found the stylesheets were non functional and the Devise logout did not work in DEVELOPMENT.
All other aspects of the application work exactly as they should.
I've been reading many stack over flow Q & A and cannot figure this out.
Then I realized the default version of Ruby did not match the version for the application.
The application was built with ruby 1.9.3 p286 and my machine boots up in Ruby 2.1.0
solution:
stop the server
rvm use ruby-1.9.3-p286
bundle install
rails server
= good to go.
I've installed rails using rvm. I've loaded rvm using ~/.bahsrc.
rails is working fine.
which rails
/home/user/.rvm/gems/ruby-2.1.0/bin/rails
but in that rails project folder which command says
/home/dinesh/.rvm/gems/ruby-2.0.0-p353#something/bin/rails
How's this happening? How to make my rails work in that folder?
If you are in the root of a rails project you may use
./script/rails --version # (or whatever rails command you want to call)
to be sure to use the rails version that corresponds to your project. Usually rails magic will apply inside a rails project and "happen" to find the correct version of rails, but there seems to be a number of things that can go wrong about that.
I recently migrated a rails 3 app from a Mac OS X environment to a Debian server. The migration succeeded, the app is running through the WEBrick server but the formatting that had originally come with the activeadmin gem has disappeared from most views. The form is still accessible and functioning but it is in the default html formatting.
However http://domainexample.com:3000/admin still has the custom formatting, any ideas of why this has happened?
In my troubleshooting:
reinstalled activeadmin with
rails generate active_admin:install
When I run
rake db:migrate
got devise errors so dropped the databases and ran
rake db:create
rails s still works and boots the server but
rake db:migrate throws an error:
Mysql2::Error: Table 'admin_users' already exists
UPDATE:
This fixed the problem, but I don't understand why.
had to copy the active_admin.css as active_admin.css.dup.css file from my local and upload it to the server version in app/assets/stylesheets. The server version was implementing namespaces for some reason.
I'm brand new to Rails. I have one Rails project on my machine, but I'd like to create a 2nd project from scratch and I'm having trouble figuring out where and how to set it up. Specifically:
My current project is located in the Projects/project1 directory. I'd like to have it located in Projects/project2. Do just reinstall Rails into that directory?
I still need access to project1. How do I switch back and forth between the two projects in terms of browser access? Will it be a separate server? Do I have to edit a file to switch?
Anything else you think I might need to know in order to manage multiple projects. Please assume that I know nothing about the setup as I'm just getting started.
My current project is located in the Projects/project1 directory. I'd like to have it located in Projects/project2. Do just reinstall Rails into that directory?
Just create a new Rails project in that directory by running rails new:
$ cd Projects
$ rails new project2
You'll have a new (empty) Rails application in project2.
I still need access to project1. How do I switch back and forth between the two projects in terms of browser access? Will it be a separate server? Do I have to edit a file to switch?
Assuming you're running local servers via rails server, you can specify which port your server is running on via -p.
Given a Rails project, you can listen on localhost:3001 by executing
$ ./script/rails server -p 3001
To run multiple Rails projects locally, make sure they're all running on a unique port.
Anything else you think I might need to know in order to manage multiple projects. Please assume that I know nothing about the setup as I'm just getting started.
Depending on your platform, you should look into Pow or Passenger which automate the process of deploying multiple Rails apps to a single server.
I am developing a website on rails. I tried to move my project on another machine and start the rails server but the server doesn't start. Instead when I enter the command rails s in terminal it creates various files. Please let me know the steps I should follow to run my project on another machine. I have rails installed there.
sounds like the other machine has rails 2 (instead of 3) installed, where running rails <something> would generate a new rails app called <something>