Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Method Error #1352

Closed
TheSynthMaster opened this issue Dec 19, 2013 · 7 comments
Closed

No Method Error #1352

TheSynthMaster opened this issue Dec 19, 2013 · 7 comments

Comments

@TheSynthMaster
Copy link

The following code in accounts.rb

def newpassword
end

  def newpassword=(newval)
    self.password = newval
  end

raise this error

NoMethodError (undefined method newpassword=' for #<Account:0x15fffa6>): app/controllers/accounts_controller.rb:140:inupdate'
app/controllers/accounts_controller.rb:139:in `update'

The same code runs ok in Yarv

@TheSynthMaster
Copy link
Author

In controller the line 140 is

@account.update_attributes(permitted_params)

with

def permitted_params
    params[:account].permit(:lock_version, :username, :password, :company_id, :usersgroup_id, :isadmin,
                            :locked, :newpassword, :password_confirmation, :last_service_id, :last_successful_login,
                            :total_logins , :password_changed , :password_change_given, :oldpassword , :last_active_at)    
  end

@headius
Copy link
Member

headius commented Dec 19, 2013

What version of JRuby? Similar bugs have been fixed in releases the past few months.

@TheSynthMaster
Copy link
Author

Latest version, 1.7.9, I switched to jruby just a few days ago...

@headius
Copy link
Member

headius commented Dec 19, 2013

Ok, thanks.

There's several possible reasons for this that are hard to sort out without a reproducible example. Can you come up with a script or a demo repository that we can use to reproduce?

@TheSynthMaster
Copy link
Author

I will try to isolate it.

The curious thing is that the same syntax works in other models, eg:

def startdate_string
    self.startdate if self.startdate
end

  def startdate_string=(new_val)
    if new_val && new_val!=""
      just_for_check = DateTime.strptime(new_val, fmt=Time::DATE_FORMATS[:app_date])
      self.startdate = new_val
    else
      self.startdate = ""
    end
    rescue ArgumentError
      @startdate_invalid = true
  end

@rtyler
Copy link

rtyler commented Aug 7, 2015

@PanDar1 it appears you're working with Rails here, I'm not sure how to reproduce this in order to see if it has been fixed in newer versions of JRuby.

Would you please provide a reproduction case or at least validate whether the issue is still present for you on newer versions of JRuby?

@kares
Copy link
Member

kares commented Jan 17, 2017

no response - probably no longer valid. please let us know if issue persist on latest of JRuby 1.7

@kares kares closed this as completed Jan 17, 2017
@kares kares added this to the Invalid or Duplicate milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants