Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not play along with model named Host #2718

Open
jurgens opened this issue Dec 3, 2024 · 3 comments
Open

Does not play along with model named Host #2718

jurgens opened this issue Dec 3, 2024 · 3 comments
Labels
bug breakages in functionality that is implemented

Comments

@jurgens
Copy link

jurgens commented Dec 3, 2024

  • What were you trying to do?
    it does not play along with a model named Host

  • What did you end up with (logs, or, even better, example apps are great!)?
    it looks like error is happening when it's trying to build a link in a collection view

link_to[actionview (7.2.2) lib/action_view/helpers/url_helper.rb]
209
        html_options, options, name = options, name, block if block_given?
        options ||= {}
        html_options = convert_options_to_data_attributes(options, html_options)
        url = url_target(name, options)
        html_options["href"] ||= url
        content_tag("a", name || url, html_options, &block)
      end
>> options
=> #<ActionController::Parameters {"host"=>#<ActionController::Parameters {"order"=>:id, "direction"=>:asc} permitted: false>} permitted: true>
>> 
>> url_target(name, options)
!! #<ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash>
>>
  • What versions are you running?
    • Rails 7.2.2
    • administrate 0.20.1
@jurgens jurgens added the bug breakages in functionality that is implemented label Dec 3, 2024
@jurgens jurgens changed the title Does not work with model named Host Does not play along with model named Host Dec 3, 2024
@nickcharlton
Copy link
Member

I wonder if the URL builder considers host to be a reserved value or something.

If you create a normal Rails controller, do you see the same behaviour?

@jurgens
Copy link
Author

jurgens commented Dec 3, 2024

It is not a reserved word, we have HostsController working with Host model in the main application.
I suspect administrate overwrites host variable in a controller or interferes in some similar way

@nickcharlton
Copy link
Member

Yeah, quite likely. Would you be able to put together an example app I can clone and try out?

I'm not sure why it would be the case that this fails, but it shouldn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug breakages in functionality that is implemented
Projects
None yet
Development

No branches or pull requests

2 participants