Pergunta

I have this problem which when I run the rake db:migrate from Heroku via the command 'heroku run rake db:migrate'

/app/app/assets/controllers/application_controller.rb:1: syntax error, unexpected =, expecting '<' or ';' or '\n'

When I change the '=' to '<'

I get the error:

/app/app/assets/controllers/application_controller.rb:1: syntax error, unexpected <, expecting '=' or ';' or '\n'

Any help is appreciated Feel free to ask for any addition files needed

Foi útil?

Solução

Your application_controller.rb file should look like this:

class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception. 
  # For APIs, you may want to use :null_session instead. 
  protect_from_forgery with: :exception 
end 

The less than symbol is used for class inheritance in Ruby.

http://rubylearning.com/satishtalim/ruby_inheritance.html

Less than or equal to and just equal to have no native usage between classes in Ruby. You can, by the way, test for inheritance using less than:

class A; end

class B < A; end

if B < A
  puts "B inherits from A"
end
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top