On Thu, Aug 13, 2009 at 10:02 AM, shusseina
<s.anderson.au-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Imagine I have a model called blog and I then run the following
> command to create a controller for it.
>
> ruby script/generate controller Blogs index
>
> At some later point I want to create a ''new'' page to
submit blogs. Is
> there a recommended way for doing this? Should I simply create the
> file app/views/blogs/new.html.erb or should I instead run the command
> below? Is there any difference?
>
Just use your text editor of choice and create the template
file, new.html.erb.
Then you need to remember to add the action, ''new'', to the
blogs_controller.
>
> ruby script/generate controller Blogs new
Now, if you run the command again on the same controller, you should see
something like this:
exists app/controllers/
exists app/helpers/
exists app/views/posts
exists test/functional/
exists test/unit/helpers/
overwrite app/controllers/blogs_controller.rb? (enter "h" for help)
[Ynaqdh]
Then you can select ''n'' if you have modified
blogs_controller.rb or ''Y'' if
have not modified this file. Then you''ll need to add the controller
action,
''new'',
to blogs_controller.rb but you wouldn''t have to create the new.html.erb
file.
Good luck,
-Conrad
>
>
> Thanks
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---