Class: BlogsController
- Inherits:
-
InheritedResources::Base
- Object
- InheritedResources::Base
- BlogsController
- Defined in:
- lib/generators/squeezer/templates/app/controllers/blogs_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/generators/squeezer/templates/app/controllers/blogs_controller.rb', line 8 def create @blog = Blog.new(params[:blog]) @blog.user =current_user if @blog.save flash[:notice] = "Successfully created blog." redirect_to @blog else render :action => 'new' end end |
#index ⇒ Object
4 5 6 |
# File 'lib/generators/squeezer/templates/app/controllers/blogs_controller.rb', line 4 def index @blogs = Blog.find(:all,:order=>'created_at desc') end |