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 8170163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:04:46+00:00 2026-06-06T21:04:46+00:00

My route file looks like this: scope :locslug/:userslug do …. …. post ‘rate/:stars’ =>

  • 0

My route file looks like this:

scope :locslug/:userslug do  
....
....

post 'rate/:stars' => 'articles#rate' :as => :rate_article
end

I’m trying to generate a form with an action that targets the rate action in articles. Ideally, when the form is submitted, a rating will either be created or updated. Elsewhere, I have that an article has_many ratings.

This doesn’t work:

= form_tag rate_article_path, :method=>'post', :id => "rate_article" do
  =hidden_field_tag :article_id, @article.id
  =hidden_field_tag :stars, 0
  =hiden_field_tag :user, current_user.id

Help is very much appreciated. Thank you.

  • 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-06T21:04:48+00:00Added an answer on June 6, 2026 at 9:04 pm

    does rails shows some error? I think you have your route wrong: ‘rate/:stars’ tells rails to expect a parameter when you call rate_article_path (something link rate_article_path(5) for 5 stars)

    you should have your route:

    post 'rate/:article_id' => 'articles#rate' :as => :rate_article
    

    your form:

    = form_tag rate_article_path(@article), :method=>'post', :id => "rate_article" do
      =hidden_field_tag :stars, 0
    

    now on your controller

    def rate
      article = Article.find(params[:article_id])
      article.rates.create(:user => current_user, :stars => params[:stars])
    end
    

    (it’s really simplified, you should do some validations, it’s just to get the idea of what to do)

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

Sidebar

Related Questions

I currently have a routes.rb file that looks like this: map.resources :profiles do |profile|
I got a zend_config file called routes.ini. Currently my url looks like this /:LanguageCode/display-cv/:CVID
I have a .htaccess file that looks like this: SetEnv APPLICATION_ENV development RewriteEngine On
Ok I have adopted a CodeIgniter Setup, My route.php in config looks like this:
I've a big file with lines that look like 2 No route to specified
Here is my route definition in the bootstrap file: $router = $this->frontController->getRouter(); $route =
I want to generate an url like this: /photo?tags=tag1,tag2,tag3 routes file: GET /photo controllers.Photos.list(tags:Array[String]
Sorry - looks like this is a duplicate of: How to get the content-type
My current .htaccess looks like this: RewriteEngine On # RewriteCond %{REQUEST_URI} !^/_project RewriteCond %{REQUEST_FILENAME}
I'm trying to route a path like this: http://www.wikipediamaze.com/wiki/Washington,_D.C. The routing framework is not

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.