Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:Extract [partial_name] shows message No such directory with file app/views/layouts/application.html.erb #534

Closed
wants to merge 1 commit into from

Conversation

naofumi-fujii
Copy link

@naofumi-fujii naofumi-fujii commented Feb 16, 2019

Problem

:Extract [partial_name] shows message No such directory with file app/views/layouts/application.html.erb

Expected

  • creates file [partial_name] in app/views/application/

Why

rails partials path has changed.
app/views/shared not found for recent Rails versions.

Rails 3.1, Rails 4, Rails 5 and whatever comes next

app/views/application
The engine searches this path automatically if the view is not found in the controller path.

Rails 3 and prior

app/views/shared
The engine does NOT search this path automatically.

Info

@tpope
Copy link
Owner

tpope commented Feb 16, 2019

Nothing changed about app/views/shared, it was just a convention that never took off. I'm fine with getting rid of it, but we should axe the whole if rails#buffer().name() =~# '^app/views/layouts/application\>' conditional.

@naofumi-fujii
Copy link
Author

fixed and force-pushed!
Could you take a look ? @tpope

else
let curdir = s:sub(rails#buffer().name(),'.*<app/views/layouts/(.*)%(\.\w*)$','app/views/\1')
if file !~ '/'
let file = "application/" .file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop this too.

Copy link
Author

@naofumi-fujii naofumi-fujii Feb 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tpope dropping this cond still shows No such directory message.

running vim command :Extract sample in app/views/layouts/application.html.erb tries to create app/views/application.html/_sample.html.erb.

@naofumi-fujii naofumi-fujii changed the title fix shared partial paths :Extract [partial_name] shows message No such directory with file app/views/layouts/application.html.erb Feb 18, 2019
@naofumi-fujii
Copy link
Author

naofumi-fujii commented Feb 19, 2019

i changed my mind to use app/views/shared for my partials.
I'm sorry for the mishap.

@naofumi-fujii naofumi-fujii deleted the fix-shared-partial-paths branch February 19, 2019 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants