Topics Covered: Building Twitter By Hand
schema.rb
file? If not, what is it good for?form_for
over form_tag
?
/tweets
corresponds to both tweets#index and tweets#create
in our routes.rb
file. How is this possible? redirect_to
achieve? How is it different from rendering a view file?routes.rb
file, if you have a route that says root 'tweets#index'
, then a redirect_to "/"
takes you to which URL? For this exercise, list the 6 steps required to put together a functioning Rails Application without scaffolding.
<<<<<<< HEADIn 9A you created User and Post, without scaffolding, to include the functionality to create new users/posts, and to see all of your posts. You also included relations for both resources.
Today we're going to continue rebuilding Meowbook by adding the update and delete actions. Before we jump in, however, we need to consider the nature of these two actions. For the update action, it makes sense that a user should be able to update a profile. Should they be able to update someone else's profile? Does it make sense for a user to be able to update a post? Do we want this kind of functionality? A user being able to delete a post also makes sense (we all say embarassing things now and again, even cats). Should a user be able to delete any post though? How about deleting users? Should you be able to delete someone else's profile?
Use these questions to think about how you would ensure that users do not have access to actions that they shouldn't.
Defining the above restrictions may be simplified by using User.last
to identify the current user. Think about which actions will require you to define the current user.
You've spent the past few days honing your proposals and planning out your apps. While the planning process is ultimately continuous, your proposals and plans flexing and evolving as issues arise, you finally have enough information about your products to actually start building! After you've finalized your resources and the attributes each will require, start creating the relevant migrations and models (remember to include your relations in your models). You will also meet with a TA before the end of the day to check in on your progress.