I'm trying to access the Devise attribute invitation_accepted_at
in my Users
objects in Users#index. The devise attributes are returned in my controller method, as well as to the Rails view. But are being lost when passed over to React in the JSX state object.
users_controller.rb
def index
@users = User.all
end
users/index.html.erb
<%= react_component("User", props: {
users: @users
}) %>
<%= javascript_pack_tag 'user' %>
User.jsx
// . . .
export default class User extends React.Component {
constructor(props) {
super(props);
this.state = { users: this.props.users };
}
// . . .
When I do a console.log( this.state.users )
, I get the original objects, but without the Devise attributes.
Is this possible? Or am I missing steps?