Skip to content

Instantly share code, notes, and snippets.

View Guillaumejfrt's full-sized avatar

Guillaume Jauffret Guillaumejfrt

View GitHub Profile
@Guillaumejfrt
Guillaumejfrt / gist:7e3bff9d1c70fba810498423c08dafbc
Last active March 7, 2018 11:10
collection_check_boxes Rails helper for advanced Simple Form
Imagine you have a blog website.
- Model and controller description: please refer to https://kitt.lewagon.com/knowledge/tutorials/css_advanced_form_checkboxes
- Sometimes, you may want to update an existing post to change its categories for instance.
- Let's us the collection_check_boxes Rails helper to design nice checkboxes in an edit view.
Refer to Rails documentation: https://apidock.com/rails/v4.0.2/ActionView/Helpers/FormOptionsHelper/collection_check_boxes
1. HTML:
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { $ACTION } from '../actions';
class $LIST_CONTAINER extends Component {
componentWillMount() {
this.props.$ACTION();
}