Topic: A simple problem made hard for a newbie

Hi I have started learning RoR recently and had like hundreds on hundreds of problems installing it on MAC.

Finally I have everything installed:

Ruby
Ruby Gems
Rails
Git
Heroku

Now I am following the following tutoria from chapter 2:

http://ruby.railstutorial.org/chapters/a-demo-app#top

And when it comes to the part to construct the data model it comes up with the following error:

Artful-Dodgers-iMac:~ mohammedshuheb$ cd ~/rails_projects
Artful-Dodgers-iMac:rails_projects mohammedshuheb$ cd demo_app
Artful-Dodgers-iMac:demo_app mohammedshuheb$ rails generate scaffold Users name:string email:string
/Users/mohammedshuheb/rails_projects/demo_app/config/application.rb:7: undefined method `groups' for Rails:Module (NoMethodError)
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.11/lib/rails/commands.rb:15:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.11/lib/rails/commands.rb:15
    from script/rails:6:in `require'
    from script/rails:6

I used the command: rails generate scaffold Users name:string email:string to make the two fields name and email.

Anyone?

Need help

Thanks!!!

Re: A simple problem made hard for a newbie

/Users/mohammedshuheb/rails_projects/demo_app/config/application.rb:7

post demo_app/config/application.rb

something is wrong on line 7

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: A simple problem made hard for a newbie

Hi Brad thanks for the reply.

Well here is the everything from the application.rb file:


require File.expand_path('../boot', __FILE__)

require 'rails/all'

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

module DemoApp
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Custom directories with classes and modules you want to be autoloadable.
    # config.autoload_paths += %W(#{config.root}/extras)

    # Only load the plugins named here, in the order given (default is alphabetical).
    # :all can be used as a placeholder for all plugins not explicitly named.
    # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

    # Activate observers that should always be running.
    # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de

    # Configure the default encoding used in templates for Ruby 1.9.
    config.encoding = "utf-8"

    # Configure sensitive parameters which will be filtered from the log file.
    config.filter_parameters += [:password]

    # Enable the asset pipeline
    config.assets.enabled = true

    # Version of your assets, change this if you want to expire all your assets
    config.assets.version = '1.0'
  end
end

Re: A simple problem made hard for a newbie

Replace this line:

Bundler.require(*Rails.groups(:assets => %w(development test)))

with

Bundler.require(:default, Rails.env) if defined?(Bundler)

If that doesn't work,  run

rails -v

and post what version your are running.

Did you copy that application.rb file from the tutorial site,   or did rails you run

rails new demo_app

Did you upgrade your version of rails between the time you first created the app and now???

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: A simple problem made hard for a newbie

No I didnt copy it I followed the instructions on the tutorial and did the following:

mkdir rails_projects

cd ~/rails_projects

mkdir demo_app

cd demo_app

Re: A simple problem made hard for a newbie

I tried with the correction you told me and this is what came up:

Artful-Dodgers-iMac:demo_app mohammedshuheb$ rails generate scaffold User name:string email:string
/Users/mohammedshuheb/.rvm/gems/ruby-1.9.2-p290@shubzinator/gems/railties-3.0.11/lib/rails/railtie/configuration.rb:77:in `method_missing': undefined method `assets' for #<Rails::Application::Configuration:0x007fcfe34c12f0> (NoMethodError)
    from /Users/mohammedshuheb/rails_projects/demo_app/config/application.rb:43:in `<class:Application>'
    from /Users/mohammedshuheb/rails_projects/demo_app/config/application.rb:13:in `<module:DemoApp>'
    from /Users/mohammedshuheb/rails_projects/demo_app/config/application.rb:12:in `<top (required)>'
    from /Users/mohammedshuheb/.rvm/gems/ruby-1.9.2-p290@shubzinator/gems/railties-3.0.11/lib/rails/commands.rb:15:in `require'
    from /Users/mohammedshuheb/.rvm/gems/ruby-1.9.2-p290@shubzinator/gems/railties-3.0.11/lib/rails/commands.rb:15:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I also typed rails -v:

Artful-Dodgers-iMac:demo_app mohammedshuheb$ rails -v
Rails 3.0.11

The ruby version is 1.9.2

Re: A simple problem made hard for a newbie

I am on a Mac with OSx Lion

What ruby, rails and ruby gems versions do you recommend me installing to get a clean install?

At the moment its not working I have tried creating more and more apps just to test if it works no luck.

I also installed MySQL and tried using that instead of sqlite3 but I can't even get that to work but that Ill have to work on later.

I need to get my install right at the moment.

Thanks again!