Closed janicemin closed 9 years ago
i'm also running into an error that i hadn't previously where if i created my profile, the zipcode doesn't show for some reason and my ajax request seems to not work because of that....it had earlier...
Just to be sure: the Profile model has a field called "zipcode", db:migrate
is correctly adding the zipcode
column to the Profile table, and db:seed
is correctly filling in the zipcode
column with values?
If you're running into AJAX problems, please open up the console in Chrome and let us know the error you're getting! Also, pushing to Github again would be great so I can take a look at your code.
i pushed it!
i'm not getting an error on the console in chrome...the meetup activity groups that i had been previously seeing just aren't showing. it had been working earlier and i'm not sure why i'm now getting errors about zipcodes. my ajax request is dependent on the profile zipcode.
in my profile table, the seeded zipcode shows up fine
Seems to be working for me!
would you be able to take a look at my ajax request? i'm not sure why when i enter a different zipcode/update a zipcode, the meetup groups aren't changing accordingly?
i thought this line of code would make it so that it reads differently each time a new user logs in or i update mine. url: 'https://api.meetup.com/find/groups?photo-host=public&zip=' + %=@profile.zipcode% + '&page=20&country=usa&sig_id=188185019&sig=d9f44a2c374e46c96fe2447861de68aa7750ec29'
i had hardcoded a zipcode earlier but then changed it to this and so assumed it was working fine until the heroku issues popped up...
the zipcode won't even show on the show page for some reason when i made a new user? i don't think i was running into this problem earlier?
Which page is the AJAX error on?
Something else to consider: if zip codes aren't essential to your app, just remove them altogether!
they are because the user is supposed to find activities in the area to preoccupy themselves, haha.
sorry in the show.html.erb file under profiles
Gotcha
Where is the AJAX request in this? What is it supposed to do?
Gaahh.
Github thinks you're writing HTML if you don't do this:
Your code
```
$.ajax({
type: 'GET',
dataType: 'jsonp',
jsonp: 'callback',
url: 'https://api.meetup.com/find/groups?photo-host=public&zip=' + <%=@profile.zipcode%> + '&page=20&country=usa&sig_id=188185019&sig=d9f44a2c374e46c96fe2447861de68aa7750ec29'
}).done(function(response){
for (i = 0; i < response["data"].length; i++){
console.log(response["data"][i])
console.log(response["data"][i]["name"])
$(".name").append("<a href='" + response["data"][i]["link"] + "'>" + response["data"][i]["name"] + "</a>")
}
})
</script>
</div>
Your AJAX request is working! Try putting console.dir(response);
right after the .done
line. You'll see that you're getting back an error message from the API. "Authentication credentials are required"
The problem with zip codes is in your profiles controller:
private
def profile_params
params.require(:profile).permit(:name, :age, :location, :phone_number, :email)
end
See anything missing?
? :p
Zipcode is missing. What tipped me off was seeing this in the server log: Unpermitted parameter: zipcode
ohhhhh!
just a follow-up question about the authentication...does this mean that i have to do something like oauth for twitter/fb but for meetup.com in order for a new user to find groups in their area?
I don't know anything about their API. Maybe? You'll need to check their API docs.
copy that. thanks!
error message when i try to heroku run rake db:seed after migrating...
i dropped my database and created, migrated and seeded again in the terminal...and the seeded zipcodes are showing up in my database.