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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:12:24+00:00 2026-06-15T08:12:24+00:00

I’ve got an embedded resource inside of a singular resource ( /profile/workout ) and

  • 0

I’ve got an embedded resource inside of a singular resource (/profile/workout) and am having some problems with the form_for helper.

I’ve defined the following helper, since profile is just based off the current_user (just redirects to the right url):

def workout_path(*args)
    profile_workout_path(*args)
end

I’ve got the following model:

class Workout
  include Mongoid::Document
  include Mongoid::Timestamps

  field :name, type: String

  embedded_in :user
  embeds_many :movements
  accepts_nested_attributes_for :movements
end

controller:

def new
  @workout = current_user.workouts.build
  @workout.movements.build
end

routes:

ComposerDelete::Application.routes.draw do
  authenticated :user do
    root :to => 'home#index'
  end

  root :to => "home#index"
  devise_for :users
  resources :users do
  end

  resource :profile do
    resources :workouts
  end
end

and form

= form_for @workout do |f|
  %fieldset
    = f.label :name
    = f.text_field :name
    = f.fields_for :movements do |builder|
      = render "movement_fields", f: builder
    = link_to_add_fields "Add Movement", f, :movements
    = f.submit "Create"

When I visit the url: http://localhost:3500/profile/workouts/50b99b70f0f800cd53000002/edit, the form has the following header:

<form accept-charset="UTF-8" action="/profile/workouts/50b99b70f0f800cd53000002" class="edit_workout" id="edit_workout_50b99b70f0f800cd53000002" method="post">

It gets the right id (edit_<model>_<id>), but the wrong method (post, should be put), also, the submit button says Create instead of Update. The form works correctly, and updates the workout.

rake routes:

                    root        /                                    home#index
                    root        /                                    home#index
        new_user_session GET    /users/sign_in(.:format)             devise/sessions#new
            user_session POST   /users/sign_in(.:format)             devise/sessions#create
    destroy_user_session DELETE /users/sign_out(.:format)            devise/sessions#destroy
           user_password POST   /users/password(.:format)            devise/passwords#create
       new_user_password GET    /users/password/new(.:format)        devise/passwords#new
      edit_user_password GET    /users/password/edit(.:format)       devise/passwords#edit
                         PUT    /users/password(.:format)            devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)              devise/registrations#cancel
       user_registration POST   /users(.:format)                     devise/registrations#create
   new_user_registration GET    /users/sign_up(.:format)             devise/registrations#new
  edit_user_registration GET    /users/edit(.:format)                devise/registrations#edit
                         PUT    /users(.:format)                     devise/registrations#update
                         DELETE /users(.:format)                     devise/registrations#destroy
                   users GET    /users(.:format)                     users#index
                         POST   /users(.:format)                     users#create
                new_user GET    /users/new(.:format)                 users#new
               edit_user GET    /users/:id/edit(.:format)            users#edit
                    user GET    /users/:id(.:format)                 users#show
                         PUT    /users/:id(.:format)                 users#update
                         DELETE /users/:id(.:format)                 users#destroy
        profile_workouts GET    /profile/workouts(.:format)          workouts#index
                         POST   /profile/workouts(.:format)          workouts#create
     new_profile_workout GET    /profile/workouts/new(.:format)      workouts#new
    edit_profile_workout GET    /profile/workouts/:id/edit(.:format) workouts#edit
         profile_workout GET    /profile/workouts/:id(.:format)      workouts#show
                         PUT    /profile/workouts/:id(.:format)      workouts#update
                         DELETE /profile/workouts/:id(.:format)      workouts#destroy
                 profile POST   /profile(.:format)                   profiles#create
             new_profile GET    /profile/new(.:format)               profiles#new
            edit_profile GET    /profile/edit(.:format)              profiles#edit
                         GET    /profile(.:format)                   profiles#show
                         PUT    /profile(.:format)                   profiles#update
                         DELETE /profile(.:format)                   profiles#destroy
  • 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-15T08:12:25+00:00Added an answer on June 15, 2026 at 8:12 am

    The method will always be POST, not PUT – your browser does not support PUT natively, so Rails hacks around this by using a hidden form field inside the form with _method=PUT. See here for some documentation on this.

    also, your own code says = f.submit "Create" so it’s no wonder the button says ‘Create’.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
i got an object with contents of html markup in it, for example: string
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

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.