You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The generated coontroller is very verbose, and not so easy on the eyes.
By removing json support we could have code that is simpler, more intuitive, and easier to understand:
# POST /ideas
def create
@idea = Idea.new(idea_params)
if @idea.save
redirect_to @idea, notice: 'Idea was successfully created.'
else
render :new
end
end
# similar for `update` and `delete`
instead of:
# POST /ideas
# POST /ideas.json
def create
@idea = Idea.new(idea_params)
respond_to do |format|
if @idea.save
format.html { redirect_to @idea, notice: 'Idea was successfully created.' }
format.json { render :show, status: :created, location: @idea }
else
format.html { render :new }
format.json { render json: @idea.errors, status: :unprocessable_entity }
end
end
end
The only downside is that, in order to do that, we need to change rails new railsgirls
into
rails new railsgirls --skip-bundle
open Gemfile and comment out gem 'jbuilder' bundle install`,
which adds 'weird things' in the beginning. Which is why I'm asking for feedback instead of PR'ing.
The text was updated successfully, but these errors were encountered:
The generated coontroller is very verbose, and not so easy on the eyes.
By removing json support we could have code that is simpler, more intuitive, and easier to understand:
instead of:
The only downside is that, in order to do that, we need to change
rails new railsgirls
into
rails new railsgirls --skip-bundle
open Gemfile and comment out
gem 'jbuilder'
bundle install`,which adds 'weird things' in the beginning. Which is why I'm asking for feedback instead of PR'ing.
The text was updated successfully, but these errors were encountered: