Important question: what the hell happened at 25:00 ?
This guy types way too fast for a tutorial. It would be sweet if there was a speed reduce button on the video. I would listen to a deep slow voice the whole time over pushing pause 900 times.
I haven’t gone through this video, but I’m assuming that they’re using devise with it.
The easiest, and probably the best is to do it globally throughout the system ( if everything needs to be authenticated ). Sometimes i’ll have open routes and authenticated routes, in which case i’ll have my main application_controller being open, then i’ll have another application_controller elsewhere, that inherits from the main, and includes the code below.
Such as in your
application_controller.rb like so:
class ApplicationController < ActionController::Base protect_from_forgery with: exception before_action :authorize_user! private def authorize_user! authenticate_user! unless current_user redirect_to root_path, alert: "you must be logged in to do that" end end end
but, don’t forget your spec for it, because tests are important!
Is there any plan to update this course for rails 4 (or even rails 5)? Rails 3 is a bit too old and is not as relevant as it used to be.
I’m using ruby 2.2.3 and rails 4.2.6. When I issued the following command
rails g monban:scaffold
it displays as following
Using strong_parameters? y
Overwrite /home/kenshinji/git/shouter/app/controllers/sessions_controller.rb? (enter “h” for help) [Ynaqdh] a
route resources :users, only: [:new, :create]
route resource :session, only: [:new, :create, :destroy]
migration_template': wrong number of arguments (1 for 2..3) (ArgumentError) from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/monban-0.0.6/lib/generators/monban/scaffold/scaffold_generator.rb:21:incopy_migration’
run' from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:ininvoke_command’
block in invoke_all' from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:ineach’
map' from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:ininvoke_all’
from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch’
start' from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/generators.rb:157:ininvoke’
<top (required)>' from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:inrequire’
block in require' from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:inload_dependency’
require' from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:123:inrequire_command!'
generate_or_destroy' from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:50:ingenerate’
run_command!' from /home/kenshinji/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in<top (required)>'
require' from bin/rails:4:in’
I had the same issue with `migration_template’: wrong number of arguments.
Did you find a solution.
Hi. I’d like to know if I can do this tutorial with Rails 4 and Ruby 2.2? Or is it preferred to install Rails 3 and Ruby 1.9? Will I have much trouble?
I’ve done the first 3 parts with Rails 4 and Ruby 2.3.0 without too much trouble. There are bits of it that are clearly outdated, but the comment sections at the bottom of the videos have been great for suggesting updates/fixes.
This doesn’t seem right to me. Rails 3 and Ruby 1.9? There are many great Rails courses online but I respect Thoughtbot’s reputation and if they recommend a course of action I would consider it an “Industry Standard” so I happily signed up for a $29 per month subscription.
This should be under a section called “Older versions of Rails” so that I can choose to learn that if I want. Even if they just said “Hey, we aren’t going to build another intermediate Rails course, there are plenty, here are links to 5 of them that we recommend you check out, just keep in mind we disagree with x, y and z on this course” then I would still consider it giving me appropriate value.
I trust and believe Thoughtbot is still staying on the cutting edge and has evolved their practices of how to build Rails apps enough that spending my efforts to learn how they did it 4 years ago is a waste of my time. Seeing this as the standard way of how they supposedly train their junior developers, must be a misunderstanding but it erodes away a bit of that trust.
Spot on, Thoughtbot needs to answer to this. I finished a bootcamp, got a rails job and have been using rails 5 since beta 2, how would this help me? If it was at least 4 I would be able to learn things since 4 isn’t that different from 5.
I got the same error and can’t find a solution. Did you work out a way round it?
Just realised you need a more recent version of monban - I just bundled monban to get the latest version and the error doesn’t happen when you generate the scaffold.
yes, I’ve figured it out, thanks
before_filter at 18:53, but this is deprecated in Rails 5. Use
before_action instead. This goes for all other
*_filter methods. Use the
*_action methods in their place!
It would be really helpful if this trail included actual descriptions of what was covered in Parts 1-4. Same goes for the ReadMe of the repo we’re asked to fork for part 1. There’s almost no information explaining what we’ll be building.
I’m getting a 404 error when I try to get to the github repo