Andreas Koutsoukos

Joined

100 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Automated email notification summary

Hi, I like to have my application to send automated emails summary to users.
Users have multiple profiles that they can make and like to notify the users by email if there is more than 5 new profiles in the app. My app is here http://www.snappaajat.fi/ so people can add them snapchat profiles and other users can view and search.

Is there some gem that do this or can Chris make some video tutorial. ;)

Posted in Liking Posts Discussion

But how about the images. I have in the profiles db image for each profile and try to get the image now like this.
<% profile.likes.each do |like| %>
<%= image_tag like.profile.image.url(), width: 20 %>
<% end %>

Now it will show the profile image that has been liked instead of the user image of the person who liked the profile.

Here is image, under the social media buttons there is liked button pressed and liked.

Posted in Liking Posts Discussion

Ou I found the problem out :)

def set_profile
@profile = Profile.friendly.find(params[:profile_id])

Posted in Liking Posts Discussion

Hi, Chris. I am using the friendly_id gem to make the profiles url.
On my like controller I have this def set_profile @profile = Profile.friendly.find(params[:id]) end.
Everything work great but when I click like button I get 404 erro message to console.
The link looks like this
Like and the console error is
POST jquery.self-a714331225d...... http://localhost:3000/profiles/vjandrei/like 404 (Not Found) What I miss here?

Posted in Pretty urls with FriendlyID Discussion

Thanks Chris for the quick reply. I managet to SQL query the slugs columns.
However now I get issue only on the production version when new object is made. In my case user can add multiple profiles.

So when user create new profile this is the error. In the local machine it works fine.

ActiveRecord::StatementInvalid (PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint

DETAIL: Failing row contains (null, demottaja, demoo, Helloo, , , , , 2016-01-02 23:04:42.689576, 2016-01-02 23:04:42.689576, null, 1, null, null, 12, null, demoo).

: INSERT INTO "profiles" ("name", "nickname", "description", "facebook", "twitter", "instagram", "linkedin", "location_id", "user_id", "slug", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id"):

app/controllers/profiles_controller.rb:61:in `block in create'

app/controllers/profiles_controller.rb:60:in `create'

I have profile model

extend FriendlyId
friendly_id :nickname, use: :slugged
Here is the repo https://github.com/vjandrei...

Ps:This is my first Rails App so I am learning same time :) The url is http://46.101.244.151/

Posted in Pretty urls with FriendlyID Discussion

Hi, Chris great tutorial ones again. However I have all ready application on the DigitalOcean and now I have to deploy the Friendly_url to it. I use the postgres db so how I can update all records from the table? So the url ID´s will show by name? In the local version sqlite I can you the Profile.find_each(&:save) and it works. But how on the production postgres version?

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.