Devise not reading User model properly? - ruby-on-rails-3

I had my app working just fine for about a year now, but I changed something I guess, and now I am getting strange Devise errors, like the below. *Note that rails console is working fine, the activerecord models (including User) are accessible as normal and I can get User.email no problem. But something is not working in the views I guess. It seems to be coming up with a no method error on User.email, which is very odd indeed. the only thing that I can think may have caused these issues is upgrading Ruby mine to latest version 6.3 recently. Maybe the gems got changed in some incompatible way?
Started GET "/" for 127.0.0.1 at 2014-05-01 18:40:12 -0700
Processing by WelcomeController#main as HTML
Completed 401 Unauthorized in 1ms
Started GET "/users/sign_in" for 127.0.0.1 at 2014-05-01 18:40:12 -0700
Processing by Devise::SessionsController#new as HTML
Rendered devise/sessions/new.html.erb within layouts/application (6.0ms)
Completed 500 Internal Server Error in 18ms
ActionView::Template::Error (undefined method `email' for #<User >):
3: <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4: <div><%= f.label :email %>
5: <br/>
6: <%= f.email_field :email %></div>
7:
8: <div><%= f.label :password %>
9: <br/>
app/views/devise/sessions/new.html.erb:6:in `block in _app_views_devise_sessions_new_html_erb__882742671_47657856'
app/views/devise/sessions/new.html.erb:3:in `_app_views_devise_sessions_new_html_erb__882742671_47657856'
Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (16.0ms)
Note when I added a line into the view:
<% u=User.first %>
It retrieved the first user no problem. So I'm not why Devise is confused. For some reason I suspect Warden maybe a problem, but the code in there is pretty opaque (at least for me)
Gems are as follows.
Gems included by the bundle:
* actionmailer (3.2.11)
* actionpack (3.2.11)
* activemodel (3.2.11)
* activerecord (3.2.11)
* activerecord-sqlserver-adapter (3.2.12)
* activeresource (3.2.11)
* activesupport (3.2.11)
* arel (3.0.3)
* bcrypt-ruby (3.0.1)
* best_in_place (2.1.0)
* builder (3.0.4)
* bundler (1.5.3)
* capistrano (2.15.5)
* coffee-rails (3.2.2)
* coffee-script (2.2.0)
* coffee-script-source (1.7.0)
* debugger-ruby_core_source (1.3.2)
* devise (2.1.2)
* dynamic_form (1.1.4)
* erubis (2.7.0)
* excon (0.31.0)
* execjs (2.0.2)
* fog (1.20.0)
* formatador (0.2.4)
* formtastic (2.2.1)
* highline (1.6.21)
* hike (1.2.3)
* i18n (0.6.9)
* journey (1.0.4)
* jquery-rails (3.1.0)
* jquery-ui-rails (4.1.2)
* json (1.8.1)
* mail (2.4.4)
* mime-types (1.25.1)
* mini_portile (0.5.2)
* monetize (0.1.4)
* money (6.0.1)
* multi_json (1.9.3)
* net-scp (1.1.2)
* net-sftp (2.1.2)
* net-ssh (2.7.0)
* net-ssh-gateway (1.2.0)
* nokogiri (1.6.1)
* orm_adapter (0.5.0)
* polyglot (0.3.4)
* rack (1.4.5)
* rack-cache (1.2)
* rack-ssl (1.3.4)
* rack-test (0.6.2)
* rails (3.2.11)
* rails3-jquery-autocomplete (1.0.12)
* railties (3.2.11)
* rake (10.3.1)
* rdoc (3.12.2)
* ruby-debug-base19x (0.11.30.pre15)
* ruby-debug-ide (0.4.22)
* ruby-odbc (0.99995)
* sass (3.3.2)
* sass-rails (3.2.6)
* sprockets (2.2.2)
* sql_server (0.1.1)
* thor (0.19.1)
* tilt (1.4.1)
* treetop (1.4.15)
* tzinfo (0.3.39)
* uglifier (2.5.0)
* warden (1.2.3)
* win32ole-pp (1.2.0)

Well, it turns out that Devise doesn't seem to like erb inside database.yml.
The change that I made that broke my app was to replace this:
development:
adapter: sqlserver
host: my_server.xxx.rds.amazonaws.com
port: 1433
database: MyDatabase
username: sa
password: the_password
with this:
development:
adapter: sqlserver
host: my_server.xxx.rds.amazonaws.com
port: 1433
database: MyDatabase
username: <%= CredentialsManager.get_db_user %>
password: <%= CredentialsManager.get_db_pass %>
While pages that don't require authentication via devise had no problem accessing the db using the new database.yml, when Devise was used, the User model it appears to be referring to has no attributes at all. (the user object represented by |f| had an #object attribute of class #, #object's attributes hash was nil. So something odd is going on inside devise when it uses database.yml to access the db. Not so sure why this is happening, but that's another thread...

Related

File to import not found or unreadable: bootstrap-wysihtml5

I have a Rails 4rc1 application with multiple engines. I'm using bootstrap-wysihtml5-rails gem in my admin engine. According to documentation I added gem 'bootstrap-wysihtml5-rails' to admin engine's Gemfile. Then when I added #import 'bootstrap-wysihtml5' to admin engine's application.scss. I get below errors:
File to import not found or unreadable: bootstrap-wysihtml5.
Load paths:
/home/zoloo/.rvm/gems/ruby-1.9.3-p429#rails-4rc1/gems/coffee-rails-4.0.0/lib/assets/javascripts
/home/zoloo/.rvm/gems/ruby-1.9.3-p429#rails-4rc1/gems/font-awesome-sass-rails-3.0.2.2/app/assets/fonts
/home/zoloo/.rvm/gems/ruby-1.9.3-p429#rails-4rc1/gems/font-awesome-sass-rails-3.0.2.2/app/assets/stylesheets
/home/zoloo/.rvm/gems/ruby-1.9.3-p429#rails-4rc1/gems/bootstrap-sass-2.3.1.0/vendor/assets/images
/home/zoloo/.rvm/gems/ruby-1.9.3-p429#rails-4rc1/gems/bootstrap-sass-2.3.1.0/vendor/assets/javascripts
/home/zoloo/.rvm/gems/ruby-1.9.3-p429#rails-4rc1/gems/bootstrap-sass-2.3.1.0/vendor/assets/stylesheets
It seems like my application.scss can't find bootstrap-wysihtml5. But why? I don't have any idea :( By the way JavaScript is working fine. And here is the my environments:
Gems included by the bundle:
* actionmailer (4.0.0.rc1)
* actionpack (4.0.0.rc1)
* activemodel (4.0.0.rc1)
* activerecord (4.0.0.rc1)
* activerecord-deprecated_finders (1.0.2)
* activesupport (4.0.0.rc1)
* addressable (2.3.4)
* admin (0.0.1)
* arel (4.0.0)
* atomic (1.1.8)
* bcrypt-ruby (3.0.1)
* bootstrap-sass (2.3.1.0)
* bootstrap-wysihtml5-rails (0.3.1.20)
* builder (3.1.4)
* bundler (1.3.5)
* capybara (2.1.0)
* carrierwave (0.8.0)
* coffee-rails (4.0.0)
* coffee-script (2.2.0)
* coffee-script-source (1.6.2)
* core (0.0.1)
* diff-lcs (1.2.4)
* erubis (2.7.0)
* execjs (1.4.0)
* factory_girl (4.2.0)
* factory_girl_rails (4.2.1)
* ffaker (1.16.1)
* font-awesome-sass-rails (3.0.2.2)
* hike (1.2.2)
* i18n (0.6.4)
* jquery-rails (2.2.1)
* kaminari (0.14.1)
* launchy (2.3.0)
* letter_opener (1.1.1)
* mail (2.5.3)
* mime-types (1.23)
* mini_magick (3.6.0)
* minitest (4.7.3)
* multi_json (1.7.2)
* nokogiri (1.5.9)
* pg (0.15.1)
* polyglot (0.3.3)
* rack (1.5.2)
* rack-test (0.6.2)
* rails (4.0.0.rc1)
* railties (4.0.0.rc1)
* rake (10.0.4)
* rspec-core (2.13.1)
* rspec-expectations (2.13.0)
* rspec-mocks (2.13.1)
* rspec-rails (2.13.2)
* sass (3.2.8)
* sass-rails (4.0.0.rc1)
* shoulda-matchers (2.1.0)
* simplecov (0.8.0.pre)
* simplecov-html (0.7.1)
* sprockets (2.9.3)
* sprockets-rails (2.0.0.rc4)
* state_machine (1.2.0)
* subexec (0.2.3)
* thor (0.18.1)
* thread_safe (0.1.0)
* tilt (1.3.7)
* treetop (1.4.12)
* tzinfo (0.3.37)
* upsert (1.2.0)
* warden (1.2.1)
* xpath (2.0.0)
as found on https://github.com/Nerian/bootstrap-wysihtml5-rails/issues/62
replace:
#import 'bootstrap-wysihtml5'
with:
#import "bootstrap-wysihtml5/core"
#import "bootstrap-wysihtml5/wysiwyg-color"

Warnings doing gem rdoc railties --ri

I have Rails 3.2.8 installed and what gem update --system says is the latest ruby gems, running ruby 1.9.3-p194 on a Mac.
When I do
gem rdoc railties --ri --overwrite
I get a plethora of warnings. (The --overwrite makes no difference). I've found various people complaining but no solutions.
Passing the errors through sort -u, the unique lines are:
Gem::SourceIndex#add_spec called from /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:127.
Gem::SourceIndex#initialize called from /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:67.
Gem::SourceIndex#load_gems_in called from /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:322.
Gem::SourceIndex#refresh! called from /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:95.
Gem::SourceIndex#search called from /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/commands/rdoc_command.rb:64.
Gem::SourceIndex#spec_dirs= called from /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:94.
Gem::SourceIndex.from_gems_in called from /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:47.
Gem::SourceIndex.from_installed_gems called from /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/commands/rdoc_command.rb:64.
Gem::SourceIndex.installed_spec_directories called from /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:47.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
NOTE: Gem::SourceIndex#search is deprecated with no replacement. It will be removed on or after 2011-11-01.
NOTE: Gem::SourceIndex#spec_dirs= is deprecated, use Specification.dirs=. It will be removed on or after 2011-11-01.
NOTE: Gem::SourceIndex.from_gems_in is deprecated with no replacement. It will be removed on or after 2011-10-01.
NOTE: Gem::SourceIndex.from_installed_gems is deprecated with no replacement. It will be removed on or after 2011-10-01.
NOTE: Gem::SourceIndex.installed_spec_directories is deprecated, use Specification.dirs. It will be removed on or after 2011-11-01.
Here is my list of gems:
*** LOCAL GEMS ***
actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activerecord_constraints (0.1.1)
activeresource (3.2.8)
activesupport (3.2.8)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.0.3)
bundler (1.1.3)
capistrano (2.13.3)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
daemons (1.1.8)
dalli (2.2.1)
erubis (2.7.0)
eventmachine (0.12.10)
execjs (1.4.0)
highline (1.6.14)
hike (1.2.1)
i18n (0.6.1)
io-console (0.3)
journey (1.0.4)
jquery-rails (2.1.2)
jquery-ui-rails (2.0.0)
jruby-pageant (1.0.2)
json (1.7.5)
mail (2.4.4)
mime-types (1.19)
minitest (2.5.1)
multi_json (1.3.6)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.5.2)
net-ssh-gateway (1.1.0)
pg (0.14.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.8)
rails-footnotes (3.7.8)
railties (3.2.8)
rake (0.9.2.2)
rdoc (3.12)
rubygems-update (1.8.24)
sass (3.1.19)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6)
thin (1.4.1)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.5)
The "ick" is "ri Rails::Engine" produces no output when in fact it has tons of really beautiful documentation. I bumped into this often on my Mac and would like to get a full set of docs working on my Mac.
What is probably a separate issue the command
gem rdoc bigdecimal --ri
produces the same warnings but ends with:
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - /usr/local/prvm/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/bigdecimal-1.1.0
Is this an issue with railties or with rubygems or my local set up?
Any way to get around it?
If there were an error RubyGems would explicitly say so and exit with a non-zero error code. For the first case, as you note, you see only warnings.
These warnings have been fixed in the RubyGems but it is not easy to back port the fix to RubyGems 1.8.
For the second case, we aim to solve this with the "default gems" feature in Ruby 2.0. The bigdecimal documentation ships as part of ruby so there is no need to regenerate it.
The question was very badly phrased. I incorrectly associated the warnings with the fact that "gem rdoc railties" did not produce the internal documentation. I finally tracked down that particular question. For some reason, the gem spec excludes all files. Just remove that line and you get good documentation.
diff -c /tmp/railties-3.2.8.gemspec ./railties-3.2.8.gemspec
*** /tmp/railties-3.2.8.gemspec 2012-09-19 08:40:57.000000000 -0500
--- ./railties-3.2.8.gemspec 2012-09-19 08:39:32.000000000 -0500
***************
*** 12,18 ****
s.executables = ["rails"]
s.files = ["bin/rails"]
s.homepage = "http://www.rubyonrails.org"
! s.rdoc_options = ["--exclude", "."]
s.require_paths = ["lib"]
s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
s.rubygems_version = "1.8.24"
--- 12,18 ----
s.executables = ["rails"]
s.files = ["bin/rails"]
s.homepage = "http://www.rubyonrails.org"
! # s.rdoc_options = ["--exclude", "."]
s.require_paths = ["lib"]
s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
s.rubygems_version = "1.8.24"

Dreamhost: two different Ruby versions and gemsets?

I am using dreamhost shared server. I get this error message, I do not understand what these error means. Does this shows passenger uses dreamhost default ruby 1.8 instead of my local 1.9.3? These error messages shows passesnger is using usr/lib/ instead of my home folders. Thanks in advance.
In config/environmnet.rb:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
RailsMichaelcunnaneCom::Application.initialize!
.
0 /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/setup.rb 10 in `exit'
1 /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/setup.rb 10
2 /usr/lib/ruby/1.8/rubygems/custom_require.rb 36 in `gem_original_require'
3 /usr/lib/ruby/1.8/rubygems/custom_require.rb 36 in `require'
4 /home/miccun2/rails.michaelcunnane.com/config/boot.rb 6
5 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
6 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `require'
7 /home/miccun2/rails.michaelcunnane.com/config/application.rb 1
8 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
9 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `require'
10 /home/miccun2/rails.michaelcunnane.com/config/environment.rb 2
11 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
12 /usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `require'
13 config.ru 3
14 /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb 46 in `instance_eval'
15 /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb 46 in `initialize'
16 config.ru 1 in `new'
17 config.ru 1
Ruby version:
miccun2#oslo:~/rails.michaelcunnane.com$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
miccun2#oslo:~/rails.michaelcunnane.com$ which ruby
/home/miccun2/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
Rails version & up and running
miccun2#oslo:~/rails.michaelcunnane.com$ rails -v
Rails 3.2.3
miccun2#oslo:~/rails.michaelcunnane.com$ which rails
/home/miccun2/.rvm/gems/ruby-1.9.3-p194/bin/rails
miccun2#oslo:~/rails.michaelcunnane.com$ rails console
Loading development environment (Rails 3.2.3)
1.9.3p194 :001 > exit
RVM version and gemset selection
miccun2#oslo:~/rails.michaelcunnane.com$ rvm gemset list
gemsets for ruby-1.9.3-p194 (found in /home/miccun2/.rvm/gems/ruby-1.9.3-p194)
global
rails_michaelcunnane_com
miccun2#oslo:~/rails.michaelcunnane.com$ rvm gemset use rails_michaelcunnane_com --default
Using ruby-1.9.3-p194 with gemset rails_michaelcunnane_com
Bundle Show after Bundle installation
miccun2#oslo:~/rails.michaelcunnane.com$ bundle show
Gems included by the bundle:
* actionmailer (3.2.3)
* actionpack (3.2.3)
* activemodel (3.2.3)
* activerecord (3.2.3)
* activeresource (3.2.3)
* activesupport (3.2.3)
* arel (3.0.2)
* builder (3.0.0)
* bundler (1.1.3)
* coffee-rails (3.2.2)
* coffee-script (2.2.0)
* coffee-script-source (1.3.1)
* erubis (2.7.0)
* execjs (1.3.2)
* hike (1.2.1)
* i18n (0.6.0)
* journey (1.0.3)
* jquery-rails (2.0.2)
* json (1.7.1)
* mail (2.4.4)
* mime-types (1.18)
* multi_json (1.3.4)
* polyglot (0.3.3)
* rack (1.4.1)
* rack-cache (1.2)
* rack-ssl (1.3.2)
* rack-test (0.6.1)
* rails (3.2.3)
* railties (3.2.3)
* rake (0.9.2.2)
* rdoc (3.12)
* sass (3.1.17)
* sass-rails (3.2.5)
* sprockets (2.1.3)
* sqlite3 (1.3.6)
* thor (0.14.6)
* tilt (1.3.3)
* treetop (1.4.10)
* tzinfo (0.3.33)
* uglifier (1.2.4)
miccun2#oslo:~/rails.michaelcunnane.com$
.
Last time I deployed a Rails 3 application Dreamhost didn't offer 1.9.2. So my app used default 1.8.7. I think they still don't offer 1.9.2.
I didn't use RVM, I wanted that at first but I think it is too much of a hassle. Dreamhost Wiki has information but it was unsupported. So no help from Dreamhost if things go wrong. No help also when using your own 1.9.2.
On my laptop I use RVM of course but on Dreamhost PS just Dreamhost Ruby 1.8.7. The only thing I needed to change to get my Passenger Rails 3 app working was .gemrc in home directory which only has
gemhome: /home/myuser/.gems/
gempath:
- /home/myuser/.gems/

Dreamhost: Ruby (Rack) application could not be started

I have been working on this problem in last two days using [http://jackassofalltrades.org/2012/02/updating-to-a-newer-rails-on-dreamhost][1]/ instruction. I have looked at other ruby on rails and dreamhost issues and instructions, but they seemed out of date. e.g 2010 etc. Moreover, I do aware of heroku which is very easy to deploy but expensive to keep running for my small project. So here are my problems.
Ruby (Rack)application could not be started - a mixture of two Ruby versions: Ruby 1.8 and 1.9 - when visiting to my website via browser.
I am unsure whether the gemset rails_michaelcollins_com remains true when i exit the terminal because every time I log in, the arrow to the particular gemset have been missing from "rvm gemset list".
Rails console error message stating "Could not find a JavaScript runtime" despite that I have Execjs 1.3.1 according to "bundle show" in rails.michaelcollins.com folder.
Thank you kindly in advance
Error mesage: Ruby (Rack) application could not be started
Application root: /home/miccol2/rails.michaelcollins.com
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/setup.rb 10 in `exit'
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/setup.rb 10
/usr/lib/ruby/1.8/rubygems/custom_require.rb 36 in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb 36 in `require'
/home/miccol2/rails.michaelcollins.com/config/boot.rb 6
/usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `require'
/home/miccol2/rails.michaelcollins.com/config/application.rb 1
/usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `require'
/home/miccol2/rails.michaelcollins.com/config/environment.rb 2
/usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `gem_original_require'
/usr/lib/ruby/1.8/rubygems/custom_require.rb 31 in `require' config.ru 3
/usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb 46 in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb 46 in `initialize'
config.ru 1 in `new'
config.ru
[oslo]$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
[oslo]$ which ruby
/home/miccol2/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
[oslo]$ rails -v
Rails 3.2.3
[oslo]$ which rails
/home/miccol2/.rvm/gems/ruby-1.9.3-p194/bin/rails
[oslo]$ rvm -v
rvm 1.13.4 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
[oslo]$ rvm gemset list
gemsets for ruby-1.9.3-p194 (found in /home/miccol2/.rvm/gems/ruby-1.9.3-p194)
global
rails_michaelcollins_com
[oslo]$ rvm gemset use rails_michaelcollins_com
Using ruby-1.9.3-p194 with gemset rails_michaelcollins_com
[oslo]$ rvm gemset list
gemsets for ruby-1.9.3-p194 (found in /home/miccol2/.rvm/gems/ruby-1.9.3-p194)
global
=> rails_michaelcollins_com
[oslo]$
[oslo]$ rails console
/home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/execjs-1.3.1/lib/execjs/runtimes.rb:50:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/execjs-1.3.1/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/execjs-1.3.1/lib/execjs.rb:4:in `<top (required)>'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `each'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `block in require'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
from /home/miccol2/rails.michaelcollins.com/config/application.rb:7:in `<top (required)>'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/railties-3.2.3/lib/rails/commands.rb:39:in `require'
from /home/miccol2/.rvm/gems/ruby-1.9.3-p194#rails_michaelcollins_com/gems/railties-3.2.3/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
[oslo]$
[oslo]$ bundle show
Gems included by the bundle:
* actionmailer (3.2.3)
* actionpack (3.2.3)
* activemodel (3.2.3)
* activerecord (3.2.3)
* activeresource (3.2.3)
* activesupport (3.2.3)
* arel (3.0.2)
* builder (3.0.0)
* bundler (1.1.3)
* coffee-rails (3.2.2)
* coffee-script (2.2.0)
* coffee-script-source (1.3.1)
* erubis (2.7.0)
* execjs (1.3.1)
* hike (1.2.1)
* i18n (0.6.0)
* journey (1.0.3)
* jquery-rails (2.0.2)
* json (1.7.1)
* mail (2.4.4)
* mime-types (1.18)
* multi_json (1.3.4)
* mysql2 (0.3.11)
* polyglot (0.3.3)
* rack (1.4.1)
* rack-cache (1.2)
* rack-ssl (1.3.2)
* rack-test (0.6.1)
* rails (3.2.3)
* railties (3.2.3)
* rake (0.9.2.2)
* rdoc (3.12)
* sass (3.1.17)
* sass-rails (3.2.5)
* sprockets (2.1.3)
* thor (0.14.6)
* tilt (1.3.3)
* treetop (1.4.10)
* tzinfo (0.3.33)
* uglifier (1.2.4)
[oslo]$
It looks like execjs can't find it a runtime JS server.
See this for morre information:
https://github.com/sstephenson/execjs
Do you need that gem? If so, you'll need to install a runtime JS server. One widely used one is https://github.com/cowboyd/therubyracer .
To install that runtime JS server, add this line to your Gemfile:
gem "therubyracer", :require => 'v8'
You've bundled execjs but it can't find a Javascript runtime, like, say, node.js.
If you truly need execjs, then install node.js.
Also, be sure that your PATH environment variable includes the path to your Javascript runtime installation before starting up Rails.

options_for_select default selection breaks under passenger

I have the following code that works perfectly in my devl (local) environment, but breaks under passenger (production):
<select name="acp[acp_type]">
<%= options_for_select ([["Standalone",0] ,["Public", 1],["Private", 2],["Both", 3]],#acp.acp_type) %>
</select>
In development, it generates a dropdown list and selects whatever is in #acp.acp_type. In production there is a Template error (see below). If I remove the ,#acp.acp_type it works fine, but I don't get the value selected.
Here is my gem list (this matches development exactly other than the passenger-related gems):
abstract (1.0.0)
actionmailer (3.0.4)
actionpack (3.0.4)
activemodel (3.0.4)
activerecord (3.0.4)
activeresource (3.0.4)
activesupport (3.0.4)
arel (2.0.10)
attributes (5.0.1)
builder (2.1.2)
bundler (1.0.18)
daemon_controller (1.0.0)
erubis (2.6.6)
factory_girl (2.0.5)
factory_girl_rails (1.1.0)
fastthread (1.0.7)
i18n (0.6.0, 0.5.0)
jquery-rails (1.0.16)
mail (2.2.19)
mime-types (1.16)
mysql (2.8.1)
mysql2 (0.2.13)
passenger (3.0.11)
polyglot (0.3.2)
prototype (2.0.0)
rack (1.2.3)
rack-cache (1.1)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.4)
railties (3.0.4)
rake (0.9.2)
rdoc (3.9.4)
rvm (1.9.2)
thor (0.14.6)
treetop (1.4.10)
tzinfo (0.3.29)
uuidtools (2.1.2)
will_paginate (3.0.2)
And the error is:
ActionView::Template::Error (/var/www/html/tpdemo/app/views/acps/_form.html.erb:19: syntax error, unexpected ',', expecting ')'
...Both", 3]],#acp.acp_type) );#output_buff...
... ^
/var/www/html/tpdemo/app/views/acps/_form.html.erb:19: syntax error, unexpected ')', expecting keyword_end
...Both", 3]],#acp.acp_type) );#output_buffer.safe_concat('
... ^):
18: <select name="acp[acp_type]">
19: <%= options_for_select ([["Standalone",0] ,["Public", 1],["Private", 2],["Both", 3]],#acp.acp_type) %>
20: </select>
21: </div>
22:
So the code looks fine, but it's very unlikely that Passenger is the culprit -- more likely the data on your other server is different -- perhaps #acp.acp_type is nil. (I think #acp is not nil, as otherwise I think you would get a nil error). Another explanation is that the data schema is outdated -- did you just add this field and still need to run a migration?