Skip to content

Instantly share code, notes, and snippets.

@bitcoiners
Created November 11, 2011 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitcoiners/1358785 to your computer and use it in GitHub Desktop.
Save bitcoiners/1358785 to your computer and use it in GitHub Desktop.
troubleshooting friendly_id with nested resources
class OptionTerm < DerivativeTerm
..
friendly_id :ticker_symbol, :use => :slugged
..
has_many :trade_volumes
..
end
routes:
resources :option_terms do
resources :trade_volumes
end
Started GET "/option_terms/BitD-USD-2011-12-1-Call-00001-00000/trade_volumes.json"
...
Processing by TradeVolumesController#index as JSON
Parameters: {"option_term_id"=>"BitD-USD-2011-12-1-Call-00001-00000"}
...
TradeVolume Load (0.6ms) SELECT `trade_volumes`.* FROM `trade_volumes` ORDER BY `trade_volumes`.`id` ASC
----------
As you may notice TradeVolumesController does not see correct option_term_id, but instead is getting the slug of OptionTerm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment