Ask A Question

Notifications

You’re not receiving notifications from this thread.

Symbols vs Strings Discussion

Discussion for Symbols vs Strings

Nice! Some of my upper division CS students struggle with the notion of symbols, and I'll point them this way.

Reply

Some videos about the basics of tests would be awesome...

Reply

Organising large rails apps is something that I struggle with. I've look at namespacing models but can never get my head around the folder structure and then the different way you have to reference a model in a namespace or scope.
Because of this I avoid it and end up with 50 models in one folder.
I'd be very happy for you to explain how to do this better?

Reply

Hey Rob - I could give you some pointers on that kind of thing. Are you in the slack channel where I could DM you? - David

Reply

Hey David - can you write your thoughts here for everyone to see?

Reply

Great episode, Chris! Love the basics/beginner genre!

Reply

Great video Chris. Would love to see one on relationships such as has_many :through and Polymorphic.

Reply

Glad to see you're adding more beginner episodes!

Reply

This is a very great episode because help me understand what's happeing under the hood. What I didn't know and I haven't hear before was what you mention at 7:18:

the last set of arguments to any function can be a hash and you don't have to specify the curly braces, they're optional

I have used that in my methods but I've never new that this could be the last argument for any function. Do you have any source to read more about this topic?

Reply

I'm still finding this a bit confusing because it seems like you're comparing apples to orange. The way I see it, which is why Im' confused is that a symbol represents something.
Like the :set_project symbol. It represents/contains the method that was defines. Where
Project was successfully created is a string and what is being represented by the notice: symbol. Am I understanding this wrong. Please clarify when you get the chance.

Reply

This was my understanding too. A symbol (the way I was thinking of it) is more like a variable name, whereas a string is a rendering or a value.

Reply

Amazing video!! Thank you so much Chris for these basic/general courses - more of these would be incredile!

Reply

So the confusion that I have around all this is where is the link between before_action :set_project and def set_project? Like how does it know that the symbol :set_project is referring to the method set_project defined elsewhere?

Reply
Reply

@chris, it looks like you have some bots getting into your comment section. Maybe add a video how you would try to stop this?

I've had the same stuff on my bigger websites. Even after the captcha and invisible honeypots didn't help, I created a validate action that checks for forbidden keywords in the posted comment and try to block them off this way...

After that some bots still got in. What I did then was check if a user was logged in during the post of the comment. If not, the comment would have to be approved by a moderator. Until now (about 6 months) no spam got to any of my customers, and I refused about 20 comments.

Reply

Very useful video, thanks.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,140+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.