It sounds like the object you’ve called .id
on is not actually an ActiveRecord model. You should only see that warning for Ruby objects where .id
is the soon-to-be deprecated version of Object#object_id
.
However, another way to access the primary key for the field with an ActiveRecord model is model.attributes['id']
so you could try that.
Related Contents:
- SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
- config.assets.compile=true in Rails production, why not?
- Fully custom validation error message with Rails
- how to permit an array with strong parameters
- How do I get the current absolute URL in Ruby on Rails?
- How to change default timezone for Active Record in Rails?
- Getting error: Peer authentication failed for user “postgres”, when trying to get pgsql working with rails
- What is the difference between
- Why isn’t my CORS configuration causing the server to filter incoming requests? How can I make the server only accept requests from a specific origin?
- What is the best method of handling currency/money?
- Learning Ruby on Rails
- How to get a random number in Ruby
- Rails – Strong Parameters – Nested Objects
- redirect_to using POST in rails
- no such file to load — rubygems (LoadError)
- In Ruby on Rails, to extend the String class, where should the code be put in?
- PG::Error: SELECT DISTINCT, ORDER BY expressions must appear in select list
- Ruby on Rails 3: Streaming data through Rails to client
- Rails: select unique values from a column
- What is Rack middleware?
- Path helpers generate paths with dots instead of slashes
- How are Rails instance variables passed to views?
- Test if string is a number in Ruby on Rails
- Heroku Postgres Error: PGError: ERROR: relation “organizations” does not exist (ActiveRecord::StatementInvalid)
- How to skip ActiveRecord callbacks? [duplicate]
- Monkey Patching in Rails 3
- Rails 4: organize rails models in sub path without namespacing models?
- Named routes _path vs _url
- What is the best way to seed a database in Rails?
- How to sign in a user using Devise from a Rails console?
- Rails 3 equivalent for periodically_call_remote
- How can I find out the current route in Rails?
- A migration to add unique constraint to a combination of columns
- How to check for a JSON response using RSpec?
- Rails 4: assets not loading in production
- Rails: around_* callbacks
- Ruby-on-Rails: Multiple has_many :through possible?
- Rails naming convention for join table
- Setting Environment Variables in Rails 3 (Devise + Omniauth)
- how to read a User uploaded file, without saving it to the database
- no such file to load — readline
- Validation for URL/Domain using Regex? (Rails)
- What do the &,
- delete_all vs destroy_all?
- Converting string from snake_case to CamelCase in Ruby
- NoMethodError when trying to invoke helper method from Rails controller
- How to do static content in Rails?
- LoadError: Could not load the ‘listen’ gem (Rails 5)
- Rails App Not Serving Assets in Production Environment
- Get anchor part of URL in controller in Ruby on Rails