views:

33

answers:

1

I have a model called Aircraft, inflected as uncountable, and it's driving me nuts. What is the correct way to handle this in Rails 3 "beta 4"?

resources :aircraft do
  member do
    get :flights
  end
end

# Of course these work for some actions and not others.
match 'aircraft', :to => 'aircraft#index', :as => :aircraft
match 'aircraft/:id', :to => 'aircraft#show', :as => :aircraft_instance
A: 

I think it's just:

resources :aircraft, :singular => :aircraft_instance

Then you link_to them like so:

link_to 'Singular aircraft', aircraft_instance_path(@aircraft)
link_to 'All aircraft', aircraft_path(@aircraft)

Edit

It looks like beta4 thinks aircrafts in the plural of aircraft:

rails console
> :aircraft.to_s.pluralize
=> "aircrafts"

If you just put resources :aircraft into your routes, can you link_to both aircraft_path(@aircraft) and aircrafts_path successfully? If so, you may need to write an initializer for ActiveSupport::Inflector to define your own custom inflection.

nfm
It used to be that way. Now {"singular"=>:aircraft_instance} shows up in the request parameters. Yes... request parameters, as if I had submitted them with the browser.
Samuel Danielson
Updated answer with new information.
nfm