On 23 May 2011 11:50, john shelfer <[email protected]> wrote:
>
>
> On Mon, May 23, 2011 at 6:38 AM, Colin Law <[email protected]> wrote:
>>
>> On 23 May 2011 11:20, john shelfer <[email protected]> wrote:
>> >
>> >
>> > On Mon, May 23, 2011 at 3:04 AM, Colin Law <[email protected]>
>> > wrote:
>> >>
>> >> On 23 May 2011 02:59, John shelfer <[email protected]> wrote:
>> >> >
>> >> >
>> >> > On May 22, 12:57 pm, Jatin kumar <[email protected]> wrote:
>> >> >> You are confusing things a lot.
>> >> >> Answer this question first:
>> >> >> Did you scaffold the model or you are adding the files one by one
>> >> >> writing
>> >> >> the code by hand.
>> >> >  I didnt scaffold.I am adding files one by one.
>> >> >
>> >> >> 1. If you did scaffold, I don't see a problem coming anywhere.
>> >> >> 2. If you didn't scaffold, then go for Colin's suggestion and read
>> >> >> the
>> >> >> guides, you will understand how Rails works.
>> >> >> AND read the guides rightnow, before you get troubled by another
>> >> >> problem.
>> >> >>
>> >> >> As of the current problem that you are facing, do this:
>> >> >> 1. Look up the database table for posts, and see if you have a
>> >> >> column
>> >> >> named
>> >> >> 'name' in there. If not, what went wrong.
>> >> >  In 'posts' table there is no column for name,title and content.
>> >>
>> >> I suggested before reading the Rails Guide on Routing.  I also suggest
>> >> that you read the Getting Started guide and then the others.  Also
>> >> work through a good tutorial (make sure it is for the version of Rails
>> >> that you are using).  railstutorial.org is a good free to use online
>> >> tutorial.
>> >
>> >           Thank you very much.I will read it now.
>> >>
>> >>  The reason is that you are missing some fundamental
>> >> understanding of how Rails works.  When you do form_for(@post) and
>> >> then f.text_field :name rails expects @post to have a method 'name' to
>> >> get the initial value for display.  Often this will come automatically
>> >> from the fact that the posts table will contain a column 'name'.
>> >> Since you have no such column it complains that Post has no method
>> >
>> >       Because i am not doing scaffold,so can i add column values
>> >       manually to table 'posts' OR changes should be made in
>> >       Model.
>>
>> You can add them using migrations.  railstutorial.org will show you
>> how to do that.
>>        I created migration  and added  following code inside and then did
>> "rake db:migrate" but still the same error persists.I think now it might
>> work,but it did not.

Have you worked right through railstutorial.org already?

Colin

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to