Ask A Question

Notifications

You’re not receiving notifications from this thread.

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?

Reply

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

Reply

right

Reply

<% if Current.user.twitter_accounts.none? %>
<%= link_to "Connect your Twitter Account", "/auth/twitter",method: :post, class: "btn btn-primary" %>
<% end %>

Reply

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?

Reply

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

Reply

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

Reply

having this error now SQLite3::ConstraintException: FOREIGN KEY constraint failed

How to fix it?

Reply

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

Reply

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

Reply
Join the discussion
Create an account Log in

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

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

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