Ok, I just fix it.

But now, It's raise this:
ActiveRecord::StatementInvalid in Users#show

Showing *app/views/users/show.dryml* where line *#4* raised:

SQLite3::SQLException: no such column: tasks.user_id: SELECT * FROM
"tasks" WHERE ("tasks".user_id = 2)


My models:

user.rb
-----------------------------------------------------------------------------------------------------------------------------------------------
  hobo_user_model

  fields do
    name          :string, :required, :unique
    role enum_string(:Coordinator, :Anlyst, :Developer, :Tester)
    email_address :email_address, :login => true
    administrator :boolean, :default => false
    timestamps
  end

  has_many :task_assignments, :dependent => :destroy
  has_many :tasks, :dependent => :destroy

  before_create { |user| user.administrator = true if !Rails.env.test? &&
count == 0 }
-----------------------------------------------------------------------------------------------------------------------------------------------


task.rb
-----------------------------------------------------------------------------------------------------------------------------------------------
  hobo_model

  fields do
    name :string
    timestamps
  end

  belongs_to :requirement, :index => 'requirement_task_index'
  has_many :task_assignments, :dependent => :destroy
  has_many :users, :through => :task_assignments
  acts_as_list :scope => :requirement
-----------------------------------------------------------------------------------------------------------------------------------------------


task_assignment.rb
-----------------------------------------------------------------------------------------------------------------------------------------------
  hobo_model

  fields do
    timestamps
  end

  belongs_to :user, :index => 'assignment_user_join_index'
  belongs_to :task, :index => 'assignment_user_join_index'
-----------------------------------------------------------------------------------------------------------------------------------------------


Can you see what's wrong?

Thanks.



2010/9/21 Owen <[email protected]>

> Actually, In the book it has "&@user.tasks...";
> http://screencast.com/t/YzE3NTVkY
>
>
> On Sep 20, 4:48 pm, kevinpfromnm <[email protected]> wrote:
> > take out &user so with="tasks.group_by..."
> >
> > if you use &user, it's looking for a variable or method called user.
> > you likely want the current context (since it's a user show page)
> > which you can skip the & if you just want to call a method on the
> > current context.
> >
> > On Sep 20, 12:52 pm, Fernando Val <[email protected]> wrote:
> >
> >
> >
> > > Hi guys,
> >
> > > I'm learning Hobo with the fantastic book "Rapid Rails with Hobo"
> > > In Tut. 17 I put de code like in the picture:
> >
> > > My model user.rb, I think, they must be the line:
> > > has_many :tasks, :dependent => :destroy
> >
> > > And in the tuto, this not appear.
> >
> > > In..views/users/show.dryml
> >
> > > <show-page>
> > >     <content-body:>
> > >         <h3><Your/> Assigned Tasks</h3>
> > >         <repeat with="&user.tasks.group_by(&:requirement)">
> > >             <h4>Requirement: <a with="&this_key"/></h4>
> > >             <collection/>
> > >         </repeat>
> > >     </content-body:>
> > > </show-page>
> >
> > > An I get this error:
> > > NoMethodError in Users#show
> >
> > > Showing *app/views/users/show.dryml* where line *#7* raised:
> >
> > > undefined method `user' for #<ActionView::Base:0x54ae5c0>
> >
> > > Extracted source (around line *#7*):
> >
> > > Is there any typo in the code? or the problem is in the model?
> >
> > > I tried this last and don't works. Raise the same error.
> >
> > > Thanks.
> >
> > > --
> > > Fernando Val
> > > Web Designerhttp://www.fernandoval.es
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<hobousers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/hobousers?hl=en.
>
>


-- 
Fernando Val
Web Designer
http://www.fernandoval.es

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en.

Reply via email to