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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:16:16+00:00 2026-05-16T07:16:16+00:00

I have one model: new and its controller: news The news controller methods: def

  • 0

I have one model: new and its controller: news

The news controller methods:

    def edit
    @new = New.find(params[:id].to_i)
  end

  def update
    @new = New.find(params[:id].to_i)
    @new.update_attributes(params[:new])
    flash[:notice] = "Sikeresen frissítve"
    redirect_to news_path
  rescue ActiveRecord::RecordInvalid
    flash[:error] = "Valami hiba lépett fel"
    redirect_to edit_news_path(@new)
  end

And here is the edit.html.erb

<%= error_messages_for :news %>

<% form_for :new, :url=>news_path(@new), :html=>{:method=>:put}  do |m|%>

  <p>  <%= m.label(:title,"title: ") %>

  <%= m.text_field(:title) %></p>

  <p>

    <%= m.label(:text, "text: ") %>

    <%= m.text_area(:text) %>

  </p>

    <%= submit_tag "Save" %>

<% end %>

It’s works fine, no error, the field showed up in the textboxes, but if I click the submit button I gave unknown action error

  • 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-05-16T07:16:17+00:00Added an answer on May 16, 2026 at 7:16 am

    I think it should be

    :url=>new_path(@new)

    not

    :url=>news_path(@new)

    though i’m confused just thinking about it due to you calling your model “new”.

    I STRONGLY recommend you change your model name (and controller and views) to avoid confusion. “New” is used in rails in the context of the ‘new’ action. If you don’t change it you will have things like “new_new_path” and “update_new_path” which is going to make you cry at some point.

    Also, it doesn’t really make sense to talk about ‘a new’. The singular of ‘news’ isn’t ‘new’. It’s very confusing all round, sort it out now before you build any more stuff around it.

    I’d recommend “Article” or something similar as a model name.

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

Sidebar

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.