<commit_before>---
layout: post
title:  "Rails views path gem released"
date:   2016-03-14 0:20
categories: rails
permalink: /rails-views-path-gem
---

# Version 0.1.0

I've created gem which allows to add views paths in controller. I wrote about this problem in my [previous](http://thepry.github.io/rails-controllers-hierarchy-and-views) post.

So just

```
# Gemfile
gem 'rails_views_path'

# app/controllers/users/posts_controller.rb
module Users
  class PostsController < ApplicationController
    add_views_path :posts
  end
end
```
After that for each action Rails will look into `app/views/users/posts/` and if view is not found, into `app/views/posts/`.
<commit_msg>Update views path gem post<commit_after>---
layout: post
title:  "Rails views path gem released"
date:   2016-03-14 0:20
categories: rails
permalink: /rails-views-path-gem
---

# Version 0.1.0

I've created gem which allows to add views paths in controller. I wrote about this problem in my [previous](http://thepry.github.io/rails-controllers-hierarchy-and-views) post.

So just

```ruby
# Gemfile
gem 'rails_views_path'

# app/controllers/users/posts_controller.rb
module Users
  class PostsController < ApplicationController
    add_views_path :posts
  end
end
```
After that for each action Rails will look into `app/views/users/posts/` and if view is not found, into `app/views/posts/`.

{'fraction_non_alphanumeric': 0.10534016093635698, 'fraction_numerical': 0.020482809070958303, 'mean_word_length': 4.123595505617978, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7236684', 'n_tokens_mistral': 469, 'n_tokens_neox': 433, 'n_words': 147}