Permalink
Browse files

ask to create when switch-to from controller or model

  • Loading branch information...
1 parent 6e78662 commit 1e51edcdd61e6de0272da770879b39ba53c8d721 @remvee committed Oct 22, 2010
Showing with 4 additions and 12 deletions.
  1. +2 −6 rails-controller-layout.el
  2. +2 −6 rails-model-layout.el
View
8 rails-controller-layout.el
@@ -166,12 +166,8 @@ If the action is nil, return all views for the controller."
(:unit-test (rails-core:unit-test-file mailer))
(:migration (rails-core:migration-file-by-model model)))))
(if item
- (let ((file (rails-core:file item)))
- (if (file-exists-p file)
- (progn
- (find-file file)
- (message (format "%s: %s" (substring (symbol-name type) 1) item)))
- (message "File %s does not exist" file)))
+ (find-or-ask-to-create (format "%s does not exists do you want to create it? " item)
+ (rails-core:file item))
(message "%s not found" name))))
(defun rails-controller-layout:switch-to-helper () (interactive) (rails-controller-layout:switch-to :helper))
View
8 rails-model-layout.el
@@ -92,12 +92,8 @@
(:model (rails-core:model-file model))
(:migration (rails-core:migration-file-by-model model)))))
(if item
- (let ((file (rails-core:file item)))
- (if (file-exists-p file)
- (progn
- (find-file file)
- (message (format "%s: %s" (substring (symbol-name type) 1) item)))
- (message "File %s does not exist" file)))
+ (find-or-ask-to-create (format "%s does not exists do you want to create it? " item)
+ (rails-core:file item))
(message "%s not found" name))))
(defun rails-model-layout:switch-to-mailer () (interactive) (rails-model-layout:switch-to :mailer))

0 comments on commit 1e51edc

Please sign in to comment.