On Martes, 27 de Julio de 2010 17:19:26 elio escribió:
> Hi, I'm really new to RoR and AS, sorry for the newbie question...
> then
> I read the doc about the nested api and I tried the example shown but
> it didn't work for me
> this is what i wrote following the getting started guide and the api
>
> reference for the nested method :
> > script/generate scaffold author name:string country:string
> > date_of_birth:date script/generate scaffold book title:string
> > genre:string year_of_publication:date rake db:migrate
To build an association as you do below, you have to add author:references in
your book migration. Error you get below is book has no author_id column
>
> after that I've deleted the views and the controller code generated
>
> inside app/views/layouts/authors.html.erb I wrote :
> <%= javascript_include_tag :defaults %>
> <%= active_scaffold_includes %>
>
> the models are :
>
> class Authors < ActiveRecord::Base
> has_many :books
> end
>
> Class Books < ActiveRecord::Base
> belongs_to :author
> end
>
> My controllers :
>
> class AuthorsController < ApplicationController
> active_scaffold :author do | config |
> config.nested.add_link("Author's books", [:books])
> end
> end
>
> class BooksController < ApplicationController
> active_scaffold :book do | config |
> end
> end
>
> that's what i wrote(really basic i know)
> when I try to create a new author i get ( code 500......) the log
> says :
>
> Rendered _horizontal_subform_record (17.0ms)
> [4;35;1mSQL (0.0ms)[0m [0mSQLite3::SQLException: no such column:
> author_id: SELECT count(*) AS count_all FROM "books" WHERE ((author_id
> IS NULL)) [0m
>
> ActionView::TemplateError (SQLite3::SQLException: no such column:
> author_id: SELECT count(*) AS count_all FROM "books" WHERE ((author_id
> IS NULL)) ) on line #8 of vendor/plugins/active_scaffold/frontends/
> default/views/_form_association_footer.html.erb:
> 5: remote_controller = nil
> 6: end
> 7:
> 8: show_add_existing = column_show_add_existing(column)
> 9: show_add_new = column_show_add_new(column, associated, @record)
> 10:
> 11: return unless show_add_new or show_add_existing
>
> vendor/plugins/active_scaffold/frontends/default/views/
> _form_association_footer.html.erb:8
> vendor/plugins/active_scaffold/frontends/default/views/
> _horizontal_subform.html.erb:19
> vendor/plugins/active_scaffold/frontends/default/views/
> _form_association.html.erb:13
> vendor/plugins/active_scaffold/frontends/default/views/
> _form.html.erb:10
> vendor/plugins/active_scaffold/frontends/default/views/
> _form.html.erb:2
> vendor/plugins/active_scaffold/frontends/default/views/
> _create_form.html.erb:41
>
> Rendered rescues/_trace (104.7ms)
> Rendered rescues/_request_and_response (0.3ms)
> Rendering rescues/layout (internal_server_error)
>
> thanks in advance for the help
--
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.