Skip to content

Add support for camel-casing ActionController::Parameters #931

@jcarlson

Description

@jcarlson

Steps to reproduce

class MyController < ApplicationController

  def foo
    props = params.permit(:foo_bar, :baz_etc)
    render component: 'foo', props: props, camelize_props: true
  end
end

Note that the given props are not properly camelized when rendered to the React component. This is because React.camelize_props does not recognize ActionController::Parameters as a valid hash and returns it as-is.

Expected behavior

React.camelize_props should camelize instances of ActionController::Parameters.

Actual behavior

React.camelize_props does not camelize instances of ActionController::Parameters.


I was going to submit a PR, but I noticed that the gem spec only requires Rails 3.2, so I wasn't sure what the best approach might be for testing with a class that didn't appear until Rails 4.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions