Man, you explain Ruby on Rails concepts so well. Wish these videos were around when I first learned Rails. Keeping coming!!
@RamintaKairyte4 жыл бұрын
Thank you!! You saved me! Worked perfectly! Love you man! :D I'm a newbie so it was a total life saver! NOTE to those who are using Rails 6: You need to figure out the iQuery issue (as Rails 6 does not support it anymore, but there is a way around it). Also the applications.js file in R6 is in a different location.
@fundifferent12 жыл бұрын
Helpful video, even though things were very out of order and back and forth, at least you went back to them. thanks
@SACSbeats5 жыл бұрын
Great video!! Really useful thanks!
@rcg91676 жыл бұрын
Great video. Thank you.
@olapohorecka76386 жыл бұрын
Thank you, that was very helpful!
@gerard_donnelly5 жыл бұрын
Exactly what I was after. Cheers
@vladj24283 жыл бұрын
Just in case anyone is getting the NameError in "your controller" "uninitialized constant" error If your model name has a space and you used an underscore, (for example i used "Post like" so i spelled it "Post_Likes" when generating the model ) Double check to make sure you don't add an underscore when using the class name at 3:28. EX: ``` like = Post_Like.where(post: Post.find(params[:post]), user: current_user) ``` This will throw the error. After messing around i figured that i have to write like this ``` like = PostLike.where(post: Post.find(params[:post]), user: current_user) ``` I didn't use the underscore and the second word has to be capital as well or it wont work. This isn't the only reason why this error can be thrown but it is something to check for. I'm not sure if this is common knowledge but I'm new to rails and coding in general so I didn't know and I hope it helps someone else.
@Deanin3 жыл бұрын
Yeah this is some Rails specific magic that happens. I'm glad you managed to work out what was wrong! Also for someone who is new to coding in general, you did a fantastic job of sharing what the issue was and how you resolved it. Those are difficult skills for a lot of people to learn, and I just wanted to say that it does make a difference when you share this information, so thank you. Good luck on your coding adventures!
@Merrderber5 жыл бұрын
Hi there! Really great video. I have a minor problem that around 7:01 I keep getting and error that says ActiveRecord::RecordNotFound (Couldn't find Post without an ID) and am extremely confused. Any help would be great thanks!
@chuggingCoffee_4 жыл бұрын
Try to change the param in your link_to to:
@RamintaKairyte4 жыл бұрын
or try: Remove the @ and add .id ==> post.id
@prodbyindigo4 жыл бұрын
when I put the remote: true code in the error stays the same and says its missing the template idk what to do it creates favorite to the index show but shows the error when i click on it
@everyllm4 жыл бұрын
The remote true is not working with this favorites code using rails 6 and Jquery it works if I put a redirect in the code but then it redirects so gets rid of the whole point of jquery favorite no refresh idk what I’m doing wrong
@prodbyindigo4 жыл бұрын
@@everyllm okay i think i figured it out I had to add require("@rails/ujs").start() to the bottom of the application.js file if anyone else has this problem
@kensanchez20644 жыл бұрын
For those who needs to add an icon instead of just text(Im using material icons): *The views (shows):* favorite *update.html.erb:* $("#favorite-icon").attr("class", ""); *application Controller:* def favorite_class if @favorite_exist "material-icons-two-tone purple-icons" else "material-icons-two-tone" end end helper_method :favorite_class This took me 9 hours to figure
@PaoliPhilippe Жыл бұрын
Trying to implement this feature using rails (7.0.4) works fine until min 12.00, but when we need to add the 'remote: true' on the show page this still doesn't work, anyone with the same issue?
@Deanin Жыл бұрын
I think most of the Rails 5 stuff will be broken in Rails 7 because they removed js.erb functionality. You might want to look into using turbo instead, which is unfortunately the preferred approach now for doing things without refreshing 🤡 Something like this might be easy enough to slot in, hopefully? kzbin.info/www/bejne/op-2e2NnmM2bfZY
@philippepaoli6904 Жыл бұрын
Thanks!
@christopherhurst76595 жыл бұрын
Would it be possibly if you could upload this code to your GitHub account? I am in a class for university and my team has used a lot of different variables and I am actually making a favorite's page for roller coaster database.
@fernandovargas26316 жыл бұрын
hello!! i have given this error "no such column: favorites " at line : @favorite_exists=Favorite.where(post: @post), user: current_user) please help me
@Deanin6 жыл бұрын
The column does not exist error told me that one of the migrations went wrong. So after dropping my database and commenting out the line: t.references :post, foreign_key: true inside of: /db/migrate/20180609051852_create_favorites.rb I managed to almost recreate this error. It's telling me: "no such column: favorites.post_id: ..." So make sure that your migration file looks something like this: class CreateFavorites < ActiveRecord::Migration[5.2] def change create_table :favorites do |t| t.references :post, foreign_key: true t.references :user, foreign_key: true t.timestamps end end end The two t.references inside of it are important. And also watch out because the @favorites line shouldn't be @favorite_exists = Favorite.where(post: @post), user: current_user) It should be: @favorite_exists = Favorite.where(post:@post, user: current_user) You should only need one opening parenthesis, and one closing parenthesis. Hopefully this helps, if not let me know and I'll try again. :)
@basilebm5 жыл бұрын
Many Thanks for this, very well explication ! One question, how to put an icon (FontAwesome) instead of text ("UnFavorite" @ "Favorite"). Should we do it into the application controller ? Many thanks
@YaroslavShmarov4 жыл бұрын
if you are using the gem 'font-awesome-saas', you can have = link_to root_path do .fa.fa-flag
@YaroslavShmarov4 жыл бұрын
example github.com/yshmarov/ror6/blob/master/app/views/static_pages/index.html.haml
@PauloVictor.175 жыл бұрын
I'm having the following error: SQLite3::SQLException: no such column: favorites.exercise I have checked everything, but I still can't find a solution
@vgfu5 жыл бұрын
How do I Replace Text with an Image?
@Nellylewis6 жыл бұрын
Hello, you did not show your routes for favorites? How do you set up them?
@rcg91675 жыл бұрын
The update route was created when he generated the Favorites controller
@giridharan47716 жыл бұрын
Please post video for forgot password and exel importing and exporting....i am a beginner...