Created
November 11, 2011 18:28
-
-
Save bitcoiners/1358785 to your computer and use it in GitHub Desktop.
troubleshooting friendly_id with nested resources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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