Created
April 15, 2014 16:54
-
-
Save fenix011/10747205 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArticlesController < ApplicationController | |
def new | |
end | |
def create | |
@article = Article.new(article_params) | |
@article.save | |
redirect_to @article | |
end | |
private | |
def article_params | |
params.require(:article).permit(:title,:text) | |
end | |
def show | |
@article = Article.find(params[:id]) | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Blog::Application.routes.draw do | |
get 'welcome/index' | |
# The priority is based upon order of creation: first created -> h$ | |
# See how all your routes lay out with "rake routes". | |
# You can have the root of your site routed with "root" | |
resources :articles | |
root 'welcome#index' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment