Is the slug size normal? - ruby-on-rails-3

I just started using Rails 3 on Heroku and was surprised at how much bigger the slug size (28MB) is compared to using Rails 2.3.5 on Heroku (less than 5MB). Is this normal? It's a simple application that only uses the reque, aasm, and unicorn gems. Everything else is the default.
source 'http://rubygems.org'
gem 'rails', '3.1.0.rc4'
gem 'pg'
# Asset template engines
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
gem 'aasm'
gem 'resque'
# Use unicorn as the web server
gem 'unicorn'
group :production do
gem 'therubyracer-heroku', '0.8.1.pre3'
end
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.1.pre.5
Running: bundle install --without development:test --path vendor/bundle --deployment
Using rake (0.9.2)
Using aasm (2.2.0)
Using multi_json (1.0.3)
Using activesupport (3.1.0.rc4)
Using bcrypt-ruby (2.1.4)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0.rc4)
Using erubis (2.7.0)
Using rack (1.3.0)
Using rack-cache (1.0.2)
Using rack-mount (0.8.1)
Using rack-test (0.6.0)
Using hike (1.1.0)
Using tilt (1.3.2)
Using sprockets (2.0.0.beta.10)
Using tzinfo (0.3.29)
Using actionpack (3.1.0.rc4)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.3.0)
Using actionmailer (3.1.0.rc4)
Using arel (2.1.3)
Using activerecord (3.1.0.rc4)
Using activeresource (3.1.0.rc4)
Using coffee-script-source (1.1.1)
Using execjs (1.2.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using rdoc (3.8)
Using thor (0.14.6)
Using railties (3.1.0.rc4)
Using jquery-rails (1.0.12)
Using json (1.5.3)
Using kgio (2.5.0)
Using pg (0.11.0)
Using bundler (1.1.pre.5)
Using rails (3.1.0.rc4)
Using raindrops (0.7.0)
Using redis (2.2.1)
Using redis-namespace (1.0.3)
Using sinatra (1.2.6)
Using vegas (0.1.8)
Using resque (1.17.1)
Using sass (3.1.4)
Using sass-rails (3.1.0.rc.4)
Using therubyracer-heroku (0.8.1.pre3)
Using uglifier (1.0.0)
Using unicorn (4.0.1)
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Creating ERB based database.yml
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Preparing app for Rails asset pipeline
-----> Discovering process types
Procfile declares types -> web, worker
Default types for Ruby/Rails -> console, rake
-----> Compiled slug size is 28.3MB
-----> Launching... done, v59

yes, it's perfectly fine. Especially since it's Rails 3.1 since it has dependency on a few large gems like rubyracer etc.

Related

rails g mongoid config error

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Master:blog shaunstanislaus$ bundle update
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Enter your password to install the bundled RubyGems to your system:
Using rake (0.9.2.2)
Enter your password to install the bundled RubyGems to your system:
Using i18n (0.6.0)
Using multi_json (1.3.6)
Using activesupport (3.2.6)
Using builder (3.0.0)
Using activemodel (3.2.6)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.6)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.6)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.6)
Using activeresource (3.2.6)
Using bson (1.6.4)
Using bson_ext (1.6.4)
Using bundler (1.1.5)
Using coffee-script-source (1.3.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.4)
Using rdoc (3.12)
Using thor (0.15.4)
Using railties (3.2.6)
Using coffee-rails (3.2.2)
Using jquery-rails (2.0.2)
Using mongo (1.0.9)
Using will_paginate (3.0.3)
Using mongoid (2.0.0.beta.19)
Using rails (3.2.6)
Using sass (3.1.20)
Using sass-rails (3.2.5)
Using sqlite3 (1.3.6)
Using uglifier (1.2.7)
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.
Master:blog shaunstanislaus$ rails g mongoid:config
/Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configuration.rb:85:in
method_missing': undefined methodgenerators' for #
(NoMethodError)
from /Library/Ruby/Gems/1.8/gems/mongoid-2.0.0.beta.19/lib/mongoid/railtie.rb:13
from /Library/Ruby/Gems/1.8/gems/mongoid-2.0.0.beta.19/lib/mongoid.rb:89:in
require'
from /Library/Ruby/Gems/1.8/gems/mongoid-2.0.0.beta.19/lib/mongoid.rb:89
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in
require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in
require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in
each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in
require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in
each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in
require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler.rb:119:in
require'
from /Users/shaunstanislaus/Desktop/code/blog/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24:in
require'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24
from script/rails:6:inrequire'
from script/rails:6
how do i fix this?
i entered this command and error appears above.
Master:blog shaunstanislaus$ rails g mongoid:config
I have done trying to remove gemfile.loc
bundle install
rails g mongoid:config, came out this error again. still the same.
Master:blog shaunstanislaus$ rails g mongoid:config
/Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in require': /Library/Ruby/Gems/1.8/gems/mongoid-3.0.3/lib/mongoid.rb:148: odd number list for Hash (SyntaxError)
{ to: Config }))
^
/Library/Ruby/Gems/1.8/gems/mongoid-3.0.3/lib/mongoid.rb:148: syntax error, unexpected ':', expecting '}'
{ to: Config }))
^
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:inrequire'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:inrequire'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:inrequire'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.5/lib/bundler.rb:119:in require'
from /Users/shaunstanislaus/Desktop/code/blog/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24:inrequire'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24
from script/rails:6:in `require'
from script/rails:6
Remove your GemFile.lock, run bundle install. If you're running on the latest version of Rails (3.2?) and Ruby (1.9.3-p###) it should work.
The reason the "generator" commands for Mongoid isn't showing is most likely that the gem didn't install properly for the version of rails and ruby you have.
Check this out: Rails g failing for mongoid commands… – Dominic Tancredi 2
I have this set up
ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0]
bundle -v
Bundler version 1.1.5
bundle install succeeds; rake server still gives the error
/Users/avaranovich/.gem/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `require': /Users/avaranovich/.gem/gems/mongoid-3.0.4/lib/mongoid.rb:148: odd number list for Hash (SyntaxError)
{ to: Config }))
I fixed this with typing bundle exec rails g mongoid:config

Bundle install not finding gem in gem list

I am trying to add devise to my application and gem install works, but everytime I run bundle install, it does not find devise in my gemlist. I have tried including the git link and using a specific version, but it still does not find it in my gemfile.
Terminal
$bundle install
$Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
Using activesupport (3.2.5)
Using builder (3.0.0)
Using activemodel (3.2.5)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.5)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.5)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.5)
Using activeresource (3.2.5)
Using coffee-script-source (1.3.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.3)
Using rdoc (3.12)
Using thor (0.15.2)
Using railties (3.2.5)
Using coffee-rails (3.2.2)
Using jquery-rails (2.0.2)
Using bundler (1.1.4)
Using rails (3.2.5)
Using sass (3.1.19)
Using sass-rails (3.2.5)
Using sqlite3 (1.3.6)
Using uglifier (1.2.4)
Your bundle is complete! Usebundle show [gemname]to see where a bundled gem is installed.
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'devise'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'

Rake gems:install yields error when following declarative authorization Railscast

I'm following Railstcast #188 to get declarative authorization running on my Rails 3 app (using Ruby 1.9.2) and am running into an issue getting the gem to install.
Ryan suggests adding it in config/environment.rb with the following:
config.gem "declarative_authorization", :source => "http://gemcutter.org"
Then install it with sudo rake gems:install.
However when I try that I get an error:
/Users/Travis/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:314:in `bin_path': can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)
I tried rake gems:install, but got this error:
Don't know how to build task 'gems:install'
The instructions to install declarative_authorization at GitHub recommend a different process, which I also followed but still couldn't get past rake:gems install.
Does anyone know what may be happening so I can get around this?
UPDATE: Here's what my config/environment.rb looks like:
RVM -v: rvm 1.10.0-pre
Gem list:
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.9, 3.0.5)
actionpack (3.0.9, 3.0.5)
activemodel (3.0.9, 3.0.5)
activerecord (3.0.9, 3.0.5)
activeresource (3.0.9, 3.0.5)
activesupport (3.0.9, 3.0.5)
addressable (2.2.6)
arel (2.0.10)
aws-s3 (0.6.2)
aws-sdk (1.3.2)
builder (2.1.2)
bundler (1.0.21 ruby)
cocaine (0.2.1, 0.2.0)
erubis (2.6.6)
faraday (0.7.6, 0.7.5)
fastercsv (1.5.4)
gemcutter (0.7.1)
heroku (2.14.0)
httparty (0.8.1)
i18n (0.6.0, 0.5.0)
jquery-rails (1.0.19, 1.0.16)
json (1.6.5)
launchy (2.0.5)
mail (2.2.19)
metaclass (0.0.1)
mime-types (1.17.2)
mocha (0.10.3, 0.10.2, 0.10.0)
multi_json (1.0.4)
multi_xml (0.4.1)
multipart-post (1.1.4)
nifty-generators (0.4.6)
nokogiri (1.5.0)
paperclip (2.5.2, 2.5.0, 2.4.5)
pg (0.12.2, 0.12.0, 0.11.0)
polyamorous (0.5.0)
polyglot (0.3.3)
rack (1.2.5, 1.2.4)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.9, 3.0.5)
railties (3.0.9, 3.0.5)
rake (0.9.2.2, 0.9.2, 0.8.7)
rake-compiler (0.7.9)
ransack (0.6.0, 0.5.8)
rdoc (3.8)
rest-client (1.6.7)
rubyzip (0.9.5)
simple_oauth (0.1.5)
sqlite3 (1.3.5, 1.3.4)
sqlite3-ruby (1.3.3)
term-ansicolor (1.0.7)
thor (0.14.6)
treetop (1.4.10)
twitter (2.1.0, 2.0.2)
tzinfo (0.3.31, 0.3.30)
uuidtools (2.1.2)
xml-simple (1.1.1)
Not sure how your environment is set up, but simply installing rake should do it. If you provide more detail (rvm, bundler, etc.) it may be of help.
gem install rake
Upon further inspection of your path, I see you're using RVM. If your paths are installed properly, you can either use the RVM Global gemset, execute the line above.
Another suggestion I have is checking out the CanCan railscast as that is the bigger norm for authorization these days, more supporters as well.
http://railscasts.com/episodes/192-authorization-with-cancan
"A few episodes ago we covered Declarative Authorization. While it is an excellent authorization plugin for Rails it can be a little heavy for simpler sites. After writing the Railscast on Declarative Authorization Ryan Bates looked for an alternative solution and, failing to find one that suited his needs, decided to write his own, CanCan." - RBates
After seeing your environment, let's try to separate the environments a little. Do this.
rvm gemset create some_other_name
rvm gemset use some_other_name
bundle install
See if this isolates your environment enough.
EDIT: I don't use rake gems:install anymore. You have bundler installed, and I'm assuming you want to use it. I do use rails g gemname:install when the documentation for such exists, I'm going to look at the railscasts again and see what rbates is telling you.
On the CANCAN github page, it says: In Rails 3, add this to your Gemfile and run the bundle command.
gem "cancan".

how to make rails 3.0 default on mac?

Here are my gems when I type in gem list in the terminal:
* LOCAL GEMS *
abstract (1.0.0)
actionmailer (3.0.10)
actionpack (3.0.10)
activemodel (3.0.10)
activerecord (3.0.10)
activeresource (3.0.10)
activesupport (3.0.10)
arel (2.0.10)
builder (2.1.2)
bundler (1.0.18)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.19)
mime-types (1.16)
minitest (1.6.0)
mysql2 (0.3.7)
polyglot (0.3.2)
rack (1.2.3)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.10)
railties (3.0.10)
rake (0.8.7)
rdoc (3.9.3, 2.5.8)
rubygems-update (1.8.9)
thor (0.14.6)
treetop (1.4.10)
tzinfo (0.3.29)
Ruby -v: ruby 1.9.2
How come when I type rails -v it gives me: Rails 1.2.6? I need the 3.0 to be the default.
Try running:
gem uninstall rails -v 1.2.6
and see if that works. You can also look into RVM there is a RailsCast http://railscasts.com/episodes/200-rails-3-beta-and-rvm
It also may be necissary to use sudo on a mac like so:
sudo gem uninstall rails

Rails 3.1.0.rc4: 304 Not Modified. Is there any known working configuration?

Trying the basic example in rails 3.1 RC 4, I get the error
Compiled app/assets/javascripts/application.js
Served asset /application.js - 304 Not Modified
(same with .css and asset/rails.png on the default index page)
My workflow is:
rails new example -j
rails g Book name:string year:integer
rake db:migrate
I get this error on both linux 64bit and win7 32 bit.
I tried many suggestions, but couldn't get it working. Is there anyone out there able to manage this known issue? Any configuration that works (combination of gems or asset setting configuration)?
[Here's my win7 gemlist:
abstract (1.0.0)
actionmailer (3.1.0.rc4)
actionpack (3.1.0.rc4)
activemodel (3.1.0.rc4)
activerecord (3.1.0.rc4)
activeresource (3.1.0.rc4)
activesupport (3.1.0.rc4)
arel (2.1.3)
bcrypt-ruby (2.1.4 x86-mingw32)
builder (3.0.0)
bundler (1.0.15)
coffee-script (2.2.0)
coffee-script-source (1.1.1)
erubis (2.7.0)
execjs (1.2.0)
hike (1.1.0)
i18n (0.6.0)
jquery-rails (1.0.12)
json (1.5.3)
mail (2.3.0)
mime-types (1.16)
multi_json (1.0.3)
polyglot (0.3.1)
rack (1.3.0)
rack-cache (1.0.2)
rack-mount (0.8.1)
rack-ssl (1.3.2)
rack-test (0.6.0)
rails (3.1.0.rc4)
railties (3.1.0.rc4)
rake (0.9.2)
rdoc (3.7)
sass (3.1.3)
sass-rails (3.1.0.rc.3)
sprockets (2.0.0.beta.10)
sqlite3 (1.3.3 x86-mingw32)
thor (0.14.6)
tilt (1.3.2)
treetop (1.4.9)
tzinfo (0.3.29)
uglifier (1.0.0)
win32-open3 (0.3.2 x86-mingw32)]
A 304 message isn't an error. When most modern browsers request a file, they also send the file's "ETag" with it to identify the version the browser currently has. If the browser's requested ETag matches the ETag on the server version, the browser will just send the 304 message instead of serving the actual file.
Essentially, it's just your app telling the browser/client "Hey, this resource hasn't changed at all since the last time you requested it, so just use your cached version. If you don't have one, then request the file again (without the ETag) and I'll give it to you."
Is something actually preventing your app from working?