Created
September 25, 2011 20:31
-
-
Save mrchrisadams/1241116 to your computer and use it in GitHub Desktop.
attributes_not_being_assigned
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Checkin < ActiveRecord::Base | |
belongs_to :user | |
# switching off validation to see if the reason attributes aren't being assigned is due to them | |
# validates :lat, :lon, :foursquare_id, :timestamp, :venue_name, :presence => true | |
attr_accessor :lat, :lon, :foursquare_id, :timestamp, :venue_name | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading development environment (Rails 3.0.10) | |
pry(main)> check = Checkin.find_or_initialize_by_foursquare_id('4e7e11b3d3e31f4bb86b9cf2') | |
=> #<Checkin id: nil, lat: nil, lon: nil, timestamp: nil, foursquare_id: nil, timezone: nil, created_at: nil, updated_at: nil, venue_name: nil, user_id: nil> | |
pry(main)> check.foursquare_id = '4e7e11b3d3e31f4bb86b9cf2' | |
=> "4e7e11b3d3e31f4bb86b9cf2" | |
pry(main)> check | |
=> #<Checkin id: nil, lat: nil, lon: nil, timestamp: nil, foursquare_id: nil, timezone: nil, created_at: nil, updated_at: nil, venue_name: nil, user_id: nil> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Schema.define(:version => 20110925195511) do | |
create_table "checkins", :force => true do |t| | |
t.string "lat" | |
t.string "lon" | |
t.datetime "timestamp" | |
t.string "foursquare_id" | |
t.string "timezone" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
t.string "venue_name" | |
t.integer "user_id" | |
end | |
create_table "users", :force => true do |t| | |
t.string "email" | |
t.string "token" | |
t.string "name" | |
t.datetime "created_at" | |
t.datetime "updated_at" | |
t.string "foursquare_id" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment