So I''m trying to start up my first rails app in quite a while (since 1.5) and I''m getting the following error: /Library/Ruby/Gems/1.8/gems/actionpack-2.3.3/lib/action_controller/ routing/builder.rb:159:in `build'': undefined method `[]'' for :comments:Symbol (NoMethodError) Obviously it doesn''t like something about my attempts at RESTful routing: map.resources :start, :only => :index map.resources :jobs do |job| map.jobs :comments end map.resources :cities, :only => [:new, :edit] map.resources :regions, :only => [:new, :edit] map.resources :countries, :only => [:new, :edit] map.resources :companies do |company| map.company :jobs, :only => :show end map.resources :departments, :only => [:new, :edit, :destroy] I''m not sure what is wrong though. According to the docs I''ve found this syntax is correct.
Hi, I think your problem may sit in your block, because you create a variable ''job'' So change from map.jobs to map.job Glen wrote:> So I''m trying to start up my first rails app in quite a while (since > 1.5) and I''m getting the following error: > > /Library/Ruby/Gems/1.8/gems/actionpack-2.3.3/lib/action_controller/ > routing/builder.rb:159:in `build'': undefined method `[]'' > for :comments:Symbol (NoMethodError) > > Obviously it doesn''t like something about my attempts at RESTful > routing: > > map.resources :start, :only => :index > map.resources :jobs do |job| > map.jobs :comments > end > map.resources :cities, :only => [:new, :edit] > map.resources :regions, :only => [:new, :edit] > map.resources :countries, :only => [:new, :edit] > map.resources :companies do |company| > map.company :jobs, :only => :show > end > map.resources :departments, :only => [:new, :edit, :destroy] > > I''m not sure what is wrong though. According to the docs I''ve found > this syntax is correct.-- Posted via ruby-forum.com.
> map.resources :jobs do |job| > map.jobs :comments > endHi change this to map.resources :jobs do |job| job.resources :comments end> map.resources :companies do |company| > map.company :jobs, :only => :show > endChange this to map.resources :companies do |company| company.resources :jobs, :only => :show end Sijo -- Posted via ruby-forum.com.
On Aug 21, 4:28 am, Sijo Kg <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > map.resources :jobs do |job| > > map.jobs :comments > > end > > Hi change this to > > map.resources :jobs do |job| > job.resources :comments > end > > > map.resources :companies do |company| > > map.company :jobs, :only => :show > > end > > Change this to > > map.resources :companies do |company| > company.resources :jobs, :only => :show > end > > Sijo > -- > Posted viahttp://www.ruby-forum.com.Thanks guys, that was embarrassing. I should know at least that much ruby.