pub fn to_foreign_key(non_foreign_key_string: &str) -> String
Expand description

Converts a &str to a foreign_key

    use inflector::suffix::foreignkey::to_foreign_key;
    let mock_string: &str = "foo_bar";
    let expected_string: String = "foo_bar_id".to_owned();
    let asserted_string: String = to_foreign_key(mock_string);
    assert!(asserted_string == expected_string);
    use inflector::suffix::foreignkey::to_foreign_key;
    let mock_string: &str = "Foo bar";
    let expected_string: String = "foo_bar_id".to_owned();
    let asserted_string: String = to_foreign_key(mock_string);
    assert!(asserted_string == expected_string);
    use inflector::suffix::foreignkey::to_foreign_key;
    let mock_string: &str = "Foo Bar";
    let expected_string: String = "foo_bar_id".to_owned();
    let asserted_string: String = to_foreign_key(mock_string);
    assert!(asserted_string == expected_string);
    use inflector::suffix::foreignkey::to_foreign_key;
    let mock_string: &str = "Foo::Bar";
    let expected_string: String = "bar_id".to_owned();
    let asserted_string: String = to_foreign_key(mock_string);
    assert!(asserted_string == expected_string);
    use inflector::suffix::foreignkey::to_foreign_key;
    let mock_string: &str = "Test::Foo::Bar";
    let expected_string: String = "bar_id".to_owned();
    let asserted_string: String = to_foreign_key(mock_string);
    assert!(asserted_string == expected_string);
    use inflector::suffix::foreignkey::to_foreign_key;
    let mock_string: &str = "FooBar";
    let expected_string: String = "foo_bar_id".to_owned();
    let asserted_string: String = to_foreign_key(mock_string);
    assert!(asserted_string == expected_string);
    use inflector::suffix::foreignkey::to_foreign_key;
    let mock_string: &str = "fooBar";
    let expected_string: String = "foo_bar_id".to_owned();
    let asserted_string: String = to_foreign_key(mock_string);
    assert!(asserted_string == expected_string);
    use inflector::suffix::foreignkey::to_foreign_key;
    let mock_string: &str = "fooBar3";
    let expected_string: String = "foo_bar_3_id".to_owned();
    let asserted_string: String = to_foreign_key(mock_string);
    assert!(asserted_string == expected_string);