I have the following:
# /config/routes.rb
resources :employees, :as => :firm_employments, :controller => :firm_employments do
resource :user_account
end
However, I'm getting the following:
@firm_employment = FirmEmployment.find(1)
@user_account = @firm_employment.employee.user_account
firm_employment_user_account_path(@firm_employment, @user_account) # => '/employees/1/user_account.3'
Why is a period and the @user_account id being appended to this path? I'm trying to get it to return simply: "/employees/1/user_account"
Thanks in advance.
If there's only one of a particular resource, then you don't pass in the id, as it's implicit:
firm_employment_user_account_path(@firm_employment)
What you're doing is supplying @user_account
as the :format
option, so of course it goes at the end after a period.
If you have more than one, you need to define the route differently:
resources :user_accounts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With