Saving Data 5/7 Create Messages I


#1

Hello guys,

I am having a hard time getting this to work. I have to map a GET on /messages/new to controller's new method and a POST on /messages to controller's create method. After creating the mapping in routes.rb and declaring the methods in messages_controller.rb i am getting this error:

/home/ccuser/.gem/ruby/2.3.0/gems/activesupport-4.1.1/lib/active_support/values/time_zone.rb:285: warning: circular argument reference - now

messages_controller.rb

Seems like i can post only one image in a post, so i considered routes to be more important :slight_smile:

class MessagesController < ApplicationController
  def index
    @messages = Message.all
  end
  
  def new
    
  end
  
  def create
    
  end
end
routes.rb

Can you please help ? I really want to understand why this error comes up and how i should deal with it. I could just skip over this exercise but that's not the point of it :smiley:

Thank you.


#2

Hi @corejumper28426,

Thanks for putting all that detail into your post! Could I please see your Gemfile and your Rails version (rails -v in the terminal)? From what I can see, it looks like you may be using a bad version of Ruby with this version of Rails.


#3

Hi,

This is my Gemfile:

gemfile

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '1.3.9'
# Use SCSS for stylesheets
gem 'sass-rails', '4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails', '3.1.2'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks', '2.4.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '2.2.2'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '0.4.0',          group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

gem 'rspec', '3.1'
gem 'rspec-rails', '3.1'
gem 'rspec-context-private', '0.0.1'
gem 'rspec-html-matchers', '0.6.1'

I skipped to 7/7 exercise in order to get access to terminal. rails -v returned Rails 4.1.1
If there is a way to access the terminal in exercise 5/7 then i will run the rails -v command there as well, but it should be the same rails version.

Thanks for helping.


#4

@corejumper2846 Would you mind adding this line to your Gemfile on line 2, then running bundle install to see if it fixes the problem?

ruby '>= 1.9.3'

#5

@zystvan Thanks. It worked :smiley:

But i had to start the chapter from 1/7 in order to keep that statement in the Gemfile through the rest of the exercises.


#6

Great! I'm glad to hear that :slight_smile:


#7

This topic is solved.