Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:02:37+00:00 2026-06-03T07:02:37+00:00

I just sorted out my inter-model relations regarding has_many :through and belongs_to; I also

  • 0

I just sorted out my inter-model relations regarding has_many :through and belongs_to; I also added the required id fields to the database table using a migration.

My question is: after user clicks on the link:

<%= link_to "subscribe", new_subscription_path(feed_url: @feed.feed_url)%>

I do this in my new method:

def new
    feed_url = params[:feed_url]
    @subscription = Subscription.new

    redirect_to reader_url, notice: "You are now subscribed to: "+Feed.find_by_feed_url(feed_url).title
  end

I just can’t figure out exactly how and where I should be calling my create method since I want the subscribe link to create a new row in my subscriptions table.

Also to make sure that my tables are correct here are my associations:

User has_many :feeds, :through => :subscriptions, dependent: :destroy

|Users table has column: id

Subscription belongs_to :feed
Subscription belongs_to :user

|Subscriptions table has columns: id, user_id, feed_id

Feed has_many :users, :through => :subscriptions

|Feeds table has column: id

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:02:39+00:00Added an answer on June 3, 2026 at 7:02 am

    You’ve just broken the whole idea of REST )

    The new actions is made to show a user some form for filling details of the resource that is being created. Even HTTP-verb GET (that you can see in your log for you new action) says that it starts an action that should NOT modify any resource.

    If you don’t need any forms, you can create direct “accessor” to your create action. But don’t make it via link_to since your users will be unable to click on it properly without javascript enabled. Use button_to:

    button_to 'Create', resources_path(your_params)
    

    And then define the creation itself inside your create action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I just want a sorted list of just dates, integers, or doubles is
I was just wondering what is the time complexty of merging two sorted arrays
This question is not a homework, it is just out of personal interest and
I'm just beginning on figuring out what works best for layout/data display in XAML
Just been looking at a code golf question about generating a sorted list of
This is probably easily sorted but I can't figure it out. I have a
I'm trying to create a sorted array out of my sortable elements but the
I need to get some stuff sorted out about all this async stuff. Let's
I just started testing out Slickgrid for a project I'm working on and I'm
Out of curiosity (I just want to know how is it done in C#)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.