test/app/app/controllers/posts_controller.rb in focused_controller-0.2.0 vs test/app/app/controllers/posts_controller.rb in focused_controller-1.0.0
- old
+ new
@@ -1,50 +1,41 @@
module PostsController
- class Action < ApplicationController
- end
-
- class Index < Action
+ class Index < ApplicationController
expose(:posts) { Post.all }
end
- class Initializer < Action
+ class New < ApplicationController
expose(:post) { Post.new params[:post] }
end
- class New < Initializer
- end
-
- class Create < Initializer
+ class Create < New
def call
if post.save
redirect_to post, :notice => 'Post was successfully created.'
else
render :action => "new"
end
end
end
- class Finder < Action
+ class Show < ApplicationController
expose(:post) { Post.find params[:id] }
end
- class Show < Finder
+ class Edit < Show
end
- class Edit < Finder
- end
-
- class Update < Finder
+ class Update < Edit
def call
if post.update_attributes(params[:post])
redirect_to post, :notice => 'Post was successfully updated.'
else
render :action => "edit"
end
end
end
- class Destroy < Finder
+ class Destroy < Edit
def call
post.destroy
redirect_to posts_url
end
end