I have installed rails on windows using railinstaller.
Using a copy of Agile Web development with Rails as my guide to learn with.
So I want to use 3.2.14 as its closer to the version they used in the book.
However after I set that version.
C:\work>rails _3.2.14_ --version
Rails 3.2.14
and create my new rails env
C:\work>rails new demo
...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
C:\work>cd demo
C:\work\demo>ls -p
Gemfile README.rdoc app/ config/ db/ log/ test/ vendor/
Gemfile.lock Rakefile bin/ config.ru lib/ public/ tmp/
When I now start a rails server I get version 4.0.0rc of rails running. Am I doing something wrong here?
C:\work>cd demo
C:\work\demo>rails server
=> Booting WEBrick
=> Rails 4.0.0.rc2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2013-08-15 10:08:39] INFO WEBrick 1.3.1
[2013-08-15 10:08:39] INFO ruby 1.9.3 (2013-05-15) [i386-mingw32]
[2013-08-15 10:08:39] INFO WEBrick::HTTPServer#start: pid=1652 port=3000
Run rails _3.2.14_ new demo to create a Rails 3.2.14 project.
Related
I have started a project to update, which was updated also a couple of months ago, but today it's not running on the development, I have deleted Gemfile.lock and reinstall the gems & update the bundler but showing still.
Here are below I have attached the full specification of this project.
// Environment
$ ruby -v
- ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20]
$ rails -v
- Rails 5.2.6
$ bundle -v
- Bundler version 2.2.31
macOS v12.0.1
When running the rails server it's showing like this below
user#Users-MacBook-Pro max-domain % rails server
=> Booting Puma
=> Rails 5.2.6 application starting in development
=> Run `rails server -h` for more startup options
Exiting
/Users/user/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/activerecord-5.2.6/lib/active_record/type/adapter_specific_registry.rb:9:in `add_modifier': wrong number of arguments (given 3, expected 2) (ArgumentError)
.........
....
I don't even find any clue where can I fix that!
Would you please help me out with that?
Thanks
If you want Ruby 3.0.1 you need to be on Rails 6.1 (and above). Max ruby version for Rails 5.2 is 2.7.0.
Here's a compatibility table.
Despite answers like these: rails s or bundle exec rails s
and blog posts like these: https://www.wyeworks.com/blog/2011/12/27/bundle-exec-rails-executes-bundler-setup-3-times/
which all seem to indicate you should simply run rails s rather than bundle exec rails s I still find that occasionally I can't simply run rails s. E.g.
$ rails s
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
Whereas running this immediately afterwards in the same environment:
$ bundle exec rails s
=> Booting WEBrick
=> Rails 4.0.0.beta1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2015-01-28 12:31:48] INFO WEBrick 1.3.1
[2015-01-28 12:31:48] INFO ruby 2.0.0 (2014-11-13) [x86_64-darwin14.0.0]
[2015-01-28 12:31:48] INFO WEBrick::HTTPServer#start: pid=18959 port=3000
Why is it not the same? Should this behaviour be fixed and, if so, how?
==== UPDATE
In response to #awendt
$ which rails
/Users/snowcrash/.rvm/gems/ruby-2.0.0-p598/bin/rails
$ rails c
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
$ bundle exec rails c
Loading development environment (Rails 4.0.0.beta1)
2.0.0-p598 :001 >
Trying to reproduce this, I get (on Ubuntu 12.04.5 LTS):
me#machine:/some/path$ rails c
The program 'rails' is currently not installed. To run 'rails' please ask your administrator to install the package 'rails'
me#machine:/some/path$ which rails
me#machine:/some/path$
So in my case, the rails script is not in my $PATH.
Your setup is different because the message explicitly mentions gems. You might even get this:
you#machine:/some/path$ which rails
/usr/bin/rails
you#machine:/some/path$
because /usr/bin/ is in your $PATH somewhere before other things and you're still invoking the rails script that ships with the OS.
Anyway, the important part is: bundle exec rails c lets Bundler figure out where to find the Rails gem, instead of letting the shell figure it out.
You may install gem into a completely arbitrary location, where only Bundler can find them because that location is not in your $PATH but in your $BUNDLE_PATH (see list of available keys for bundle config).
That's why rails and bundle exec rails are not the same.
This is not an error, and the behavior should not be fixed. Yes, you shouldn't have to run bundle exec rails because in recent versions, rails does the exact same thing. But the error you're seeing is a different issue.
For Rails 3x and above,whenever you are running the rails server,its always in context of the your environment and your Gemfile.So bundler helps in this regards to start and load the required gems/libraries using $BUNDLE_PATH for starting the application which by default wont be there if your are not using bundle exec instead it includes only the default libraries/gems using gemset(if you are using rvm) OR default path to load.
..hope this helps
I want to use the Terminal built into Aptana Studio 3. I have everything configured on iTerm2/Terminal. I'm developing a Rails project. I do the following to get the server going.
On the Aptana Terminal:
$ rails s
Could not find pg-0.17.1 in any of the sources
Run `bundle install` to install missing gems.
On the regular Terminal or iTerm2:
~ rails s
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-08-12 16:15:17] INFO WEBrick 1.3.1
[2014-08-12 16:15:17] INFO ruby 2.0.0 (2013-11-22) [x86_64-darwin13.2.0]
[2014-08-12 16:15:17] INFO WEBrick::HTTPServer#start: pid=2612 port=3000
Both Terminals are on the same working directory. I could do bundle install on Aptana Terminal, but it is a chain of errors that occurs. I had that similar situation with iTerm2 and Terminal, but it was a very long and tedious process.
How can I properly configure the Aptana Terminal ?
This must be a simple question, but I could not find the answer by browsing this forum.
When I check rails version, it shows version 3.2.8
user#domain.com [~/rails_apps]# rails -v
Rails 3.2.8
user#domain.com [~/rails_apps]#
But when I start the server, it runs version 2.3.11
user#domain.com [~/rails_apps/myapp]# script/server -p12011
=> Booting Mongrel
=> Rails 2.3.11 application starting on http://0.0.0.0:12011
/home3/user/rails_apps/myapp/config/environment.rb:45: warning: already initialized constant RAILS_ENV
NOTE: SourceIndex.new(hash) is deprecated; From /usr/lib64/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:100:in `new'.
=> Call with -d to detach
=> Ctrl-C to shutdown server
What am I doing wrong?
If you application is a 2.x rails application, you need to complete some changes before upgrade to 3.x
You may have a look to railscast http://railscasts.com/?tag_id=27
On the other hand, you may want to upgrade your ruby to 1.9 using rvm
rails 3.x work better with ruby 1.9
Try following in your environment.rb
RAILS_GEM_VERSION = '3.2.8' unless defined? RAILS_GEM_VERSION
Check your Gemfile and make sure it is pointing to rails 3.2.8
Then run bundle or bundle update
I wonder if this is an old app, built originally upon rails 2.3.1 and periodically upgraded insitu. Instead of script/server, try rails server
And make sure your Gemfile contains reference to rails 3.2.8
I currently have:
$ rails s
=> Booting WEBrick
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-11-30 13:18:00] INFO WEBrick 1.3.1
[2011-11-30 13:18:00] INFO ruby 1.9.2 (2011-02-18) [x86_64-darwin10.8.0]
[2011-11-30 13:18:00] INFO WEBrick::HTTPServer#start: pid=4204 port=3000
The problem I'm having is I'm using openID for auth and getting the following error:
[2011-11-30 13:18:19] ERROR WEBrick::HTTPStatus::RequestURITooLarge
In the browser:
Request-URI Too Large
WEBrick::HTTPStatus::RequestURITooLarge
WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18) at macbook-pro.local:3000
How can I fix this? Can I update WEBrick or do I really need to use a different web server?
Thanks
In Ruby 1.9.3. source, it says that MAX_URI_LENGTH = 2083. That means that the latest version of Webrick can't handle urls longer that this. And that's what the WEBrick::HTTPStatus::RequestURITooLarge exception is telling you.
The solution therefore is to use a different web server. One of the most favourite ones is Thin:
sudo gem install thin
cd to/your/rails/app
thin -h
thin -a localhost start
Like said here, you could change the MAX_URI_LENGTH using this code:
WEBrick::HTTPRequest.const_set("MAX_URI_LENGTH", 10240)
I see you've tried unicorn: have you tried running it through bundler? Add:
gem :unicorn
to your Gemfile and run:
bundle exec unicorn_rails
to start the server and browse to http://localhost:8080.