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

  • Home
  • SEARCH
  • 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 8877307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:26:14+00:00 2026-06-14T19:26:14+00:00

Here’s my controller class ActivitiesController < ApplicationController def exercises if current_user.userprofile.present? #chef whether there

  • 0

Here’s my controller

class ActivitiesController < ApplicationController 
  def exercises
    if current_user.userprofile.present? #chef whether there is a userprofile object
     @weeknum = current_user.userprofile.week 
     @dayly_activity = Activity.where(:week => 1, :day => 'Monday').first   
    end #end check userprofile     
  end

 def updatexercises
   respond_to do | format | 
    @dayly_activity = Activity.where(:week => 1, :day => 'Monday').first 
    @dayly_activity.update_attributes(params[:@dayly_activity])  
    @dayly_activity.save 
    format.html { render action: "exercises" }
  end
 end  
end

And my template

<h1>WEEKLY EXERCICES</h1>

Day : <%= @dayly_activity.day %>

<%= form_for(@dayly_activity, :url => { :action => "updatexercises" }) do | f | %>
<table>
<tr>
    <td>Jogging:</td>
    <td>
        <% list = (0..20).to_a %>
        <%= f.select :jog, list %>
        x 0.1 km
    </td>
</tr>
<tr>
    <td>Bicycling:</td>
    <td>
        <% list = (0..10).to_a %>
        <%= f.select :bicycl, list %>
        km
    </td>
</tr>
<tr>
    <td>Push ups:</td>
    <td>
        <% list = (0..20).to_a %>
        <%= f.select :pushups, list %>
        x 10 times
    </td>
</tr>
<tr>
    <td colspan = "2"><%= f.submit %></td>
</tr>
  </table>

<% end %>

When I click the button, the Daily+activity object is not being saved. Am I missing some thing

EDIT

I’ve tried to hard code this way and it saving to the database.

@dayly_activity.jog = 17
@dayly_activity.pushups = 13
@dayly_activity.save

Obviously, the problem must be with the update_attributes

  • 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-14T19:26:16+00:00Added an answer on June 14, 2026 at 7:26 pm

    You need to use params[:dayly_activity] (drop the @ sign).

    Also, I would put these two lines :

       @dayly_activity = Activity.where(:week => 1, :day => 'Monday').first 
       @dayly_activity.update_attributes(params[:dayly_activity])
    

    Outside of your respond_to block (put them on top of it).

    You can also drop the @dayly_activity.save, update_attributes do it automatically and will returns true/false if it works/fails.

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

Sidebar

Related Questions

Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }
Here is my class: public class A{ private void doIt(int[] X, int[] Y){ //change
Here is my problem : I have a post controller with the action create.
here is my code, SiteMember class @OneToMany(mappedBy = member,cascade=CascadeType.ALL) private List<MemberThread> memberThread = new
Here is an object that I'd like to use with ng-repeat, but it's not
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here's what I'm trying to do... It's quite simple and obviously there must be
Here's my class: public class JsoupParser { ArrayList<CompanyInfo> arr = new ArrayList<CompanyInfo>(); public static
Here I have HTML tag dynamically generated by jQuery say.. <tr id=CustomerScreen class=rows></tr> <tr
Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>

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.