active_support dependencies error when using candy - ruby-on-rails

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.

Related

Rails test error in terminal

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.

rails new and rails -v throwing this error

This is what happened when I ran rails -v or rails new. Haven't mucked around at all either. I figured i'd post here before trashing the install and re-installing rails.
Assuming my install is shot
/Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require': /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/options.rb:124: syntax error, unexpected '[', expecting '|' (SyntaxError)
...make any changes.') { |options[:pretend]| }
... ^
/Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/options.rb:127: syntax error, unexpected '[', expecting '|'
...ss normal output.') { |options[:quiet]| }
... ^
/Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/options.rb:128: syntax error, unexpected '[', expecting '|'
...ktrace on errors.') { |options[:backtrace]| }
... ^
/Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/options.rb:129: syntax error, unexpected '[', expecting '|'
...his help message.') { |options[:help]| }
... ^
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator/base.rb:1:in `<top (required)>'
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/lib/rails_generator.rb:34:in `<top (required)>'
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:112:in `require'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/gems/rails-0.13.1/bin/rails:14:in `<top (required)>'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/bin/rails:19:in `load'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/bin/rails:19:in `<main>'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/fugazy/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
My buddy didn't have rails in that directory, I fixed that. Didn't realize it until #benjamin Sinclaire pointed out the versions #.

acts_as_tree and rails 3.2.3, not compatible?

I am using Rails 3.2.3 and acts_as_tree 1.1.0. I have been using acts_as_tree for a handful different projects with earlier versions of Rails 3 (such as 3.1.1.) with no problems but it won't work at all for this version. If it is because of 3.2.3 or something else that I use I have not been able to confirm though.
This is what I have tried, to no avail:
- Using acts_as_tree on several different controllers
- Only using acts_as_tree (with no order statement)
- Run bundle install and bundle update
- Double check that parent_id exist and is integer
First, when I tried this I got at first try:
undefined method `acts_as_tree'
reloading the page (and not doing anything else) caused:
undefined method `key?' for nil:NilClass
then restarting the server caused a failure to launch (the app would crash and not start) with the following error:
/Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require': /Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:78: odd number list for Hash (SyntaxError)
foreign_key: "parent_id",
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:78: syntax error, unexpected ':', expecting '}'
foreign_key: "parent_id",
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:78: syntax error, unexpected ',', expecting kEND
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:79: Can't assign to nil
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:80: syntax error, unexpected ':', expecting '='
counter_cache: nil,
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:80: Can't assign to nil
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:81: syntax error, unexpected ':', expecting '='
dependent: :destroy
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:82: syntax error, unexpected '}', expecting kEND
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:86: syntax error, unexpected ':', expecting kEND
belongs_to :parent, class_name: name,
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:87: syntax error, unexpected ':', expecting '='
foreign_key: configuration[:foreign_key],
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:88: syntax error, unexpected ':', expecting '='
counter_cache: configuration[:counter_cache],
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:89: syntax error, unexpected ':', expecting '='
inverse_of: :children
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:91: syntax error, unexpected ':', expecting kEND
has_many :children, class_name: name,
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:92: syntax error, unexpected ':', expecting '='
foreign_key: configuration[:foreign_key],
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:93: syntax error, unexpected ':', expecting '='
order: configuration[:order],
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:94: syntax error, unexpected ':', expecting '='
dependent: configuration[:dependent],
^
/Library/Ruby/Gems/1.8/gems/acts_as_tree-1.1.0/lib/acts_as_tree.rb:95: syntax error, unexpected ':', expecting '='
inverse_of: :parent
^
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
from /Users/Christoffer/Documents/Webbprojekt/rails/Presenttips/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:53:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:53
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:50
from script/rails:6:in `require'
from script/rails:6
which makes me guess there is a compability issue btw Rails 3.2.3 and acts_as_tree. I do not know how to verify this though.
What options do I have? I don't necessarily need to use Rails 3.2.3 but if I downgrade to 3.1.1. (which I tried) I encounter other problems that seem worse (the "file setup" does not seem to be the same).
So, what are my options? Have you experienced this as well? There IS something wrong with acts_as_tree, right?
Looks like there's an open from 2 years ago
opened this issue 2 years ago Does not work with Rails 2.3.8 https://github.com/rails/acts_as_tree/issues/1
Options
acts_as_tree_rails3 gem install acts_as_tree_rails3
or
nested_set https://github.com/skyeagle/nested_set
Edit:
You are right, the new location is https://github.com/amerine/acts_as_tree same author
with a comment
We no longer support Ruby 1.8 or versions if Rails/ActiveRecord older
than 3.0. If you're using a version of ActiveRecord older than 3.0
please use 0.1.1.
Moving forward we will do our best to support the latest versions of
ActiveRecord and Ruby
That's why they did not bother with those opened issues

Error when running rails or rake command on fresh install

macbook air bought yesterday. Installed homebrew, xcode, rails, git, cloned out my project fine. Running "rails s" or rake db:create, rake db:migrate etc. all return this same error. Have run bundle install. Seems really odd, perhaps requiring reinstall but what should I reinstall?
/Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': /Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:31: odd number list for Hash (SyntaxError)
title: #meta_title,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:31: syntax error, unexpected ':', expecting '}'
title: #meta_title,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:32: syntax error, unexpected ':', expecting '='
keywords: #meta_keywords,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:33: syntax error, unexpected ':', expecting '='
description: #meta_description,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:34: syntax error, unexpected ':', expecting '='
author: #meta_author,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:35: syntax error, unexpected ':', expecting '='
email: #meta_email,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:36: syntax error, unexpected ':', expecting '='
copyright: #meta_copyright,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:37: syntax error, unexpected ':', expecting '='
generator: #meta_generator,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:38: syntax error, unexpected ':', expecting '='
rating: #meta_rating,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:39: syntax error, unexpected ':', expecting '='
language: #meta_language,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:40: syntax error, unexpected ':', expecting '='
distribution: #meta_distribution,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:41: syntax error, unexpected ':', expecting '='
robots: #robots,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:42: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"fb:app_id" => #meta_fb_app_id,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:43: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:title" => #meta_og_title,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:44: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:description" => #meta_og_description,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:45: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:url" => request.url,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:46: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:site_name" => #meta_og_site_name,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:47: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:type" => #meta_og_type,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:48: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:image" => #meta_og_image,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:49: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:locality" => #meta_og_locality,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:50: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:region" => #meta_og_region,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:51: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:country_name" => #meta_og_country_name,
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:52: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
:"og:phone_number" => #meta_og_phone_number
^
/Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers/metatag_helper.rb:58: syntax error, unexpected $end, expecting kEND
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /Library/Ruby/Gems/1.8/gems/frontend-helpers-0.0.7/lib/frontend-helpers.rb:2
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /Users/davidganly/work/vvx/config/application.rb:13
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/commands.rb:52:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/commands.rb:52
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.0/lib/rails/commands.rb:49
from script/rails:6:in `require'
from script/rails:6
I didn't have ruby 1.9.2. -- Just hadn't noticed. Anyway, did the sensible thing and installed via rvm and now everything is up and running.
Had my previous answer deleted because I was asking what I'm supposed to do if I can't update to 1.9.x, since the accepted answer doesn't really solve the problem.
Btw I submitted a patch to frontend-helpers which is now merged into master :
https://github.com/christopherhein/frontend-helpers/commit/b2ce595d2dd183b643fbe4c3c22cd9defbc24ed7
So if you run into this issue just upgrade your Gemfile !

expecting tASSOC in a Rails file

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.

Resources