New Discussion

Notifications

You’re not receiving notifications from this thread.

Rails for Beginners Part 29: Tweets Index & New Actions Discussion

10
General

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?

I agree. Mine just works with "method: :post" added.

right

<% 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?

I do not know Alex, because I am new at rails , but I think for now it is a good idea.

I think that looks good, what I would suggest is auth_twitter_account instead of connect_twitter_account.

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

This course is gold! I'm definitely subscribing after I finish it.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 88,275+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.