Dennis Njogu

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Authenticating Blog Admin Pages Discussion

Can devise also handle authorization? or is it something you have to build yourself

Posted in Adding a New Blog Post Action Discussion

Correct me if i am wrong but the way i understand this is that
When we click on a particular id, a request with that id as its params will be sent to get blog_posts/:id.
Since our action for that particular url is set to show in our , the show method in the controller will handle that.
The show method creates a @blog_post instance attribute that holds the blog with the id that was sent over, then through our view we render that particular blog_post.
Then the user visits the blog_post/new url to create a new url..this then is handled by the new action that overwrites the blog_post that the user was previously reading.....yes?
Or are there two @blog_post instance variables created?

Why is that important? Why cant we create two instance variables that track two different things ie the blog_post last read, and the new one being created?

Posted in Adding a New Blog Post Action Discussion

Hi Chris, i have noticed that the show action has an instance variable called @blog_post. Which is the current blog post being viewed.
Why are we overwriting that variable in the new action?

Posted in Modular Code Organization Discussion

also why is it that extending self in a module will enable us to call the methods inside the module in a class that extends the said module. I know it works but WHY does it work?

Posted in Modular Code Organization Discussion

what does self in modules reference? is it the object of the Module?