Thanks Matt!

my model tabs are up now!
but I have no access to them via admin, this is the error:

undefined method `administrator?' for #<User:0x3fb6d5c>
RAILS_ROOT: /Users/Mister/dev/hobo

Application Trace | Framework Trace | Full Trace
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/
attribute_methods.rb:255:in `method_missing_without_find_for'
/opt/local/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/find_for.rb:
48:in `method_missing'
/Users/Mister/dev/hobo/app/models/about.rb:10:in `create_permitted?'
app/views/taglibs/auto/admin/rapid/pages.dryml:38:in
`index_page__for_about'
app/views/taglibs/auto/admin/rapid/pages.dryml:37:in
`index_page__for_about'
app/views/taglibs/auto/admin/rapid/pages.dryml:37:in
`index_page__for_about'
app/views/taglibs/auto/admin/rapid/pages.dryml:22:in
`index_page__for_about'
app/views/taglibs/themes/clean/clean.dryml:2:in
`page_without_a8e4621306d7'
app/views/taglibs/themes/clean/clean.dryml:1:in
`page_without_a8e4621306d7'
app/views/taglibs/admin_site.dryml:14:in `page'
app/views/taglibs/admin_site.dryml:13:in `page'
app/views/taglibs/auto/admin/rapid/pages.dryml:19:in
`index_page__for_about'
app/views/taglibs/auto/admin/rapid/pages.dryml:18:in
`index_page__for_about'

///----------------------------------

this is my user model:

class User < ActiveRecord::Base

  hobo_model # Don't put anything above this

  acts_as_authentic
  acts_as_voter

  fields do
    username          :string, :required, :unique
    email :username, :login => true
    administrator :boolean, :default => false
    role   enum_string(:administrator, :reviewer, :member, :banned)
    timestamps
  end


  has_many :posts
  has_many :styles

  #ROLES = %w[administrator moderator author banned]

  # This gives admin rights to the first sign-up.
  # Just remove it if you don't want that
  before_create { |user| user.administrator = true if !Rails.env.test?
&& count == 0 }


  # --- Signup lifecycle --- #

  lifecycle do

    state :active, :default => true

    create :signup, :available_to => "Guest",
           :params =>
[:username, :email_address, :password, :password_confirmation],
           :become => :active

    transition :request_password_reset, { :active
=> :active }, :new_key => true do
      UserMailer.deliver_forgot_password(self, lifecycle.key)
    end

    transition :reset_password, { :active => :active }, :available_to
=> :key_holder,
               :params => [ :password, :password_confirmation ]

  end



  # --- Permissions --- #

  def create_permitted?
    true
  end

  def update_permitted?
    acting_user.administrator? ||
      (acting_user == self && only_changed?(:email, :crypted_password,
                                            :current_password, :password, 
:password_confirmation))
    # Note: crypted_password has attr_protected so although it is
permitted to change, it cannot be changed
    # directly from a form submission.
  end

  def destroy_permitted?
    acting_user.administrator?
  end

  def view_permitted?(field)
    true
  end


  def to_s
    username
  end

  def guest?
    false
  end

  def signed_up?
    true
  end

  def login
    email
  end

end


///----------------------------------


UserSessionsController

class UserSessionsController < ApplicationController
layout 'mini'
  def new
    @user_session = UserSession.new

  end


  def create
    @user_session = UserSession.new(params[:user_session])
    if @user_session.save
      session[:user] = @user_session.record.typed_id
      flash.now[:notice] = "You have logged in!"
      redirect_to root_url
    else
      render :action => 'new'
    end
  end


  def destroy
    @user_session = UserSession.find
    @user_session.destroy
    flash[:notice] = "You have logged out!"
    redirect_to root_url
  end
end

///----------------------------------

Also the Hobo user nav and toggle is not there.

I have added first_name last_name and role to my user model.

still not working.

Any full tutorials I should know about?

On May 3, 3:48 pm, Matt Jones <[email protected]> wrote:
> On Mon, May 3, 2010 at 3:09 AM, Daniel <[email protected]> wrote:
> > I'm trying to use hobo with authlogic. Hobo is used only For the admin
> > area.
> > Hobo seems to be running ok but when I this line   "session[:user] =
> > user.typed_id"
>
> As I said before, the 'user' local you're referencing here isn't set
> by anything, so you're getting the typed_id of nil.
>
> Based on the Authlogic Railscast, I think you'll want to use this:
>
> session[:user] = @user_session.record.typed_id
>
> To interface cleanly with Hobo.
>
> --Matt Jones
>
> --
> 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 
> athttp://groups.google.com/group/hobousers?hl=en.

-- 
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