Rails for Beginners Part 29: Tweets Index & New Actions Discussion
At around 6:30 where you add the /auth/twitter/ link, the method: needs to be added as a :post correct, for OAuth 2.0?
<% if Current.user.twitter_accounts.none? %>
<%= link_to "Connect your Twitter Account", "/auth/twitter",method: :post, class: "btn btn-primary" %>
<% end %>
I set an alias for the auth/twitter path like so:
post 'auth/twitter', as: 'connect_twitter_account'
It's working but do you think it is ok to do so or is it a bad idea to mix this route, provided by omniauth, with the one we define ourselves?
having this error now SQLite3::ConstraintException: FOREIGN KEY constraint failed
How to fix it?
Checkout the video 39 (https://gorails.com/episodes/rails-for-beginners-part-39-dependent-destroy-model-associations)
Go in the file twitter_account.rb
and replace:
has_many :tweets
with:
has_many :tweets, dependent: :destroy