I'm sure I've done something stupid here, but I just can't see it.
I call the breadcrumb method in the application view.
app/helpers/breadcrumbs_helper.rb says:
module BreadcrumbsHelper
def breadcrumb
#crumb_list = []
drominay_crumb_builder
project_crumb_builder
content_tag(:div, :id => "breadcrumbs", #crumb_list.map { |list_item| crumb_builder(list_item) })
end
def crumb_builder(list_item)
if list_item == #crumb_list.last
content_tag(:span, list_item['body'], :class => list_item['crumb'])
else
body = ["list_item['body']", " → "].join
link_to(body, list_item['url'], :class => list_item['crumb'])
end
end
def drominay_crumb_builder
list_item = Hash.new
list_item['body'] = "Drominay"
list_item['url'] = "root"
#crumb_list << list_item
end
def project_crumb_builder
end
end
Why oh why am I getting this "expecting tASSOC" error? (And what is a tASSOC anyway?)
steven-nobles-imac-200:drominay steven$ script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Exiting
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': /Users/steven/Drominay/app/helpers/breadcrumbs_helper.rb:7: syntax error, unexpected ')', expecting tASSOC (SyntaxError)
/Users/steven/Drominay/app/helpers/breadcrumbs_helper.rb:29: syntax error, unexpected $end, expecting kEND
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
from /Users/steven/Drominay/app/helpers/application_helper.rb:5
from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:382:in `load_without_new_constant_marking'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:382:in `load_file'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
... 56 levels...
from /Users/steven/.gem/ruby/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
tASSOC means the => operator
It was because I had the arguments for content_tag in the wrong order.
Am still interested in knowing what a tASSOC is, however.
Related
I'm a beginner trying to learn rails. When i tried to run the "rails test" command, I get this message. I don't understand what this message is :/
rails test
Running via Spring preloader in process 46753
/Users/.../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require': /Users/..../test/controllers/static_pages_controller_test.rb:26: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `block in require'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/test_requirer.rb:14:in `block in require_files'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/test_requirer.rb:13:in `each'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/test_requirer.rb:13:in `require_files'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/minitest_plugin.rb:94:in `plugin_rails_init'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:81:in `block in init_plugins'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:79:in `each'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:79:in `init_plugins'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:130:in `run'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.1/lib/rails/test_unit/minitest_plugin.rb:77:in `run'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/minitest-5.10.2/lib/minitest.rb:63:in `block in autorun'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/..../.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
The error message is actually telling you exactly where the issue is.
On line 26 of your static_pages_controller_test.rb file, you're missing an end.
...static_pages_controller_test.rb:26: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)...
It's telling you that you likely have either ommitted an end from your static_pages_controller_test.rb file. Or, you have an extra end in that file.
If you look at the error:
..../test/controllers/static_pages_controller_test.rb:26 syntax error,
unexpected end-of-input, expecting keyword_end (SyntaxError)`
It's telling you that something is amiss on line 26.
Then syntax error, means you have typed something incorrectly.
It then says unexpected end-of-input which means that the parser couldn't figure out where to end the method, and the reason for that is that it was expecting keyword_end, which means there is an end keyword missing.
I am trying to start WEBRick for my local developement without any success. Below is the error message that i am getting. Any insight on why it might be failing?
Thanks
C:\Sites\ThinkBlog\crumblr>rails s
=> Booting WEBrick
=> Rails 4.1.4 application starting in development
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces .
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `initialize': Invalid argume`enter code here`nt - ${::Rails.root}/config/facebook.yml (Errno::EINVAL)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/psych.rb:297:in `load_file'
from C:/Sites/ThinkBlog/crumblr/config/initializers/abook.rb:1:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
You have interpolated your string incorrectly, the interpolation starts with hash sign (#), not dollar.
You need either to change this string to:
FACEBOOK_CONFIG = YAML.load_file("#{::Rails.root}/config/facebook.yml")[::Rails.env]
Or do it without interpolation at all:
sth = YAML.load_file(Rails.root.join 'config', 'facebook.yml')
I am trying to learn Ruby by following the railstutorial.org website. I am at the automated tests part, running Guard but it throws an error:
C:\Users\Thomas\Documents\Development\teachmtg.com [master]> bundle exec guard
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard/dsl.rb:119:in `instance_eval': C:/Users/Thomas/Documents/Development/teachmtg.com/Guardfile:4: syntax error, unexpected ',' (SyntaxError)
guard 'rspec', :version => 2 do, :all_after_pass => false do
^
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard/dsl.rb:119:in `instance_eval_guardfile'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard/dsl.rb:74:in `evaluate_guardfile'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard.rb:147:in `setup_from_guardfile'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard.rb:63:in `setup'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard.rb:188:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/lib/guard/cli.rb:110:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/guard-1.8.1/bin/guard:6:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/bin/guard:23:in `load'
from C:/RailsInstaller/Ruby1.9.3/bin/guard:23:in `<main>'
As I am completely new to Ruby and Rails, I have no idea where to look, what to look for, etc.
Can you give me a few tips and pointers ?
Thanks !
Remove do from :version => 2 do, :all_after_pass ... expression in Guardfile.
I'm recently began working on a project which I've cloned from github.
Everytime I try start the rails server I get the following error:
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in load': /Users/thomas/Projects/BillingMiddleware/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_BillingMiddleware_session'
^
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:inload'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in load_dependency'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:inload'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:588
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:587:in each'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:587
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:ininstance_exec'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:in run'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:55:inrun_initializers'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:in each'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:inrun_initializers'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application.rb:136:in initialize!'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:insend'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in method_missing'
from /Users/thomas/Projects/BillingMiddleware/config/environment.rb:5
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:inrequire'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in require'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:inload_dependency'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in require'
from /Users/thomas/Projects/BillingMiddleware/config.ru:4
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:ininstance_eval'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in initialize'
from /Users/thomas/Projects/BillingMiddleware/config.ru:1:innew'
from /Users/thomas/Projects/BillingMiddleware/config.ru:1
My collegue is also working on the project and doesn't seem to have any problems starting the server. He is running the same version of ruby, rails and WeBrick as me.
I've tried changing the syntax from key: to :key =>, this shouldn't be the problem though as I am running ruby version 1.9.3. If I make that change anyhow I get a different error message:
/Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load': /Users/thomas/Projects/BillingMiddleware/config/initializers/wrap_parameters.rb:8: syntax error, unexpected ':', expecting kEND (SyntaxError)
wrap_parameters format: [:json]
^
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:588
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:587:in `each'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/engine.rb:587
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `run_initializers'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `send'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/thomas/Projects/BillingMiddleware/config/environment.rb:5
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /Users/thomas/Projects/BillingMiddleware/config.ru:4
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /Users/thomas/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /Users/thomas/Projects/BillingMiddleware/config.ru:1:in `new'
from /Users/thomas/Projects/BillingMiddleware/config.ru:1
I've tired completely removing and re-installing rvm, ruby and rails several times to no prevail. I’ve also tried running bundle install which hasn’t help.
Does anyone have any idea of what’s going wrong?
Thanks
Try changing your hashes to :key => :value syntax. The same error and fixes are discussed at Rails 3.1 Deployment to Heroku Error.
The temp fixes suggested are:
config/initializers/session_store.rb
App::Application.config.session_store :cookie_store, :key => '_BillingMiddleware_session'
config/initializers/wrap_parameters.rb
ActionController::Base.wrap_parameters :format => [:json]
Looks like hash syntax on another line, after you fixed that one. Check config/intializers/wrap_parameters.rb and i wonder if this project got the flag to "not" use the new syntax?
I am getting the following error when I use Candy in my Rails project. Really a syntax error?
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require': /home/waleed/.bundler/ruby/1.8/candy-daa2670a71e3/lib/candy/array.rb:56: syntax error, unexpected ':', expecting kEND (SyntaxError)
...lection.find_and_modify query: {"_id" => #__candy_parent.id}...
^
/home/waleed/.bundler/ruby/1.8/candy-daa2670a71e3/lib/candy/array.rb:56: syntax error, unexpected ',', expecting kEND
...{"_id" => #__candy_parent.id}, update: {'$pop' => {#__candy_...
^
/home/waleed/.bundler/ruby/1.8/candy-daa2670a71e3/lib/candy/array.rb:56: syntax error, unexpected ',', expecting kEND
... {#__candy_parent_key => -1}}, new: false
^
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
from /home/waleed/.bundler/ruby/1.8/candy-daa2670a71e3/lib/candy/piece.rb:1
Any ideas why?
Per the project's GitHub page, the Candy gem only works on Ruby 1.9 -- you're using 1.8.