You must have a model if you're going to call Post.new. That's where
that 'new' method happens. The model tells the controller what fields
it should initialize, which tells the view that the default values are
whatever they are, etc. It's MVC, not VC!
Walter
>
>
>
>
> --
> 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-
> ta...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
> .
>
Why are you making a post in the index action? This action should
just be showing posts.
You have not told us which line is failing, but I guess it is the one that says
@post=Post.new
which says make a new Post object, but since you have not written the
Post model how can it make a Post object?
You cannot make a form for an object without defining the model first.
form_for( @post ) makes a form for the object @post.
Colin
Amrit I cannot believe that you are asking that question. Look back
through your questions and you will see you have asked similar
questions several times. Always the answer is to rake routes to what
routes you have defined (and so whether posts_path is valid) and to
re-read the Rails Guides on Routing if you do not know how to get that
path defined.
Can you explain how it is that you have to keep asking the question?
Am I the only one thinking that this poster is winding us up?
Colin
Since post 1 I've thought you're banging your head against a wall :-/
Stuff like "this is not a [h]ard and fast rule that it must be used
for showing posts." is ridiculous...
If he wants to "just doing experiment" and use the index action to
create, then be surprised at problems, then he's on a limb on his own.
I'm all for helping people, but they've got to help themselves first
[1]. No-one is here to be anyone else's crutch 24/7.
[1] or at least be able to help themselves with some prompting....
>> On 1 May 2011 05:52, amrit pal pathak <amritpalpath...@gmail.com> wrote:
>>> ...
>> Am I the only one thinking that this poster is winding us up?
> Not at all.He is new to Rails So I think we should help him
> to
> resolve the issue.
Ok John. Thanks for volunteering to help sort Amrit out. Over to you.
Good luck
Colin