fixed in edge 7f3cd00707efda648a875b36f4a17a6aa2064618 Thank you dd
On Thu, Feb 17, 2011 at 12:16 AM, Bilal Ahmed <[email protected]>wrote: > This is happening even if a new hobo project is created without > modifying anything and checking the user show page. > > Controller: > ---------------------------------------------------------------- > > class UsersController < ApplicationController > > hobo_user_controller > > auto_actions :all, :except => [ :index, :new, :create ] > > def create > hobo_create do > if valid? > self.current_user = this > flash[:notice] = > t("hobo.messages.you_are_site_admin", :default=>"You are now the site > administrator") > redirect_to home_page > end > end > end > > end > > Model > ________________________ > > class User < ActiveRecord::Base > > hobo_user_model # Don't put anything above this > > fields do > name :string, :required, :unique > email_address :email_address, :login => true > administrator :boolean, :default => false > timestamps > end > > # This gives admin rights and an :active state to the first sign-up. > # Just remove it if you don't want that > before_create do |user| > if !Rails.env.test? && user.class.count == 0 > user.administrator = true > user.state = "active" > end > end > > > # --- Signup lifecycle --- # > > lifecycle do > > state :active, :default => true > > create :signup, :available_to => "Guest", > :params => > [:name, :email_address, :password, :password_confirmation], > :become => :active > > transition :request_password_reset, { :active > => :active }, :new_key => true do > UserMailer.forgot_password(self, lifecycle.key).deliver > end > > transition :reset_password, { :active => :active }, :available_to > => :key_holder, > :params => [ :password, :password_confirmation ] > > end > > # --- Permissions --- # > > def create_permitted? > # Only the initial admin user can be created > self.class.count == 0 > end > > def update_permitted? > acting_user.administrator? || > (acting_user == self && only_changed? > (:email_address, :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 > end > > > > On Feb 16, 7:23 pm, Domizio Demichelis <[email protected]> wrote: > > code please :-) > > > > ciao > > dd > > > > > > > > On Wed, Feb 16, 2011 at 9:01 PM, Bilal Ahmed <[email protected]> > wrote: > > > NoMethodError in Users#show > > > > > Showing controller: users; dryml-tag: show-page where line #1 raised: > > > > > undefined method `model_name' for "active":User::LifecycleStateField > > > Extracted source (around line #1): > > > > > 0 > > > Rails.root: /rails_projects/test_project > > > > > Application Trace | Framework Trace | Full Trace > > > app/views/taglibs/auto/rapid/pages.dryml:640:in `block (6 levels) in > > > show_page__for_user' > > > app/views/taglibs/auto/rapid/pages.dryml:639:in `block (5 levels) in > > > show_page__for_user' > > > app/views/taglibs/auto/rapid/pages.dryml:639:in `block (4 levels) in > > > show_page__for_user' > > > app/views/taglibs/auto/rapid/pages.dryml:622:in `block (3 levels) in > > > show_page__for_user' > > > app/views/taglibs/themes/clean/clean.dryml:2:in `block in > > > page_with_aaa82d3a9ca5' > > > app/views/taglibs/themes/clean/clean.dryml:1:in > > > `page_with_aaa82d3a9ca5' > > > app/views/taglibs/auto/rapid/pages.dryml:618:in `block in > > > show_page__for_user' > > > app/views/taglibs/auto/rapid/pages.dryml:617:in `show_page__for_user' > > > Request > > > > > Parameters: > > > > > {"id"=>"3-test-user"} > > > Show session dump > > > > > Show env dump > > > > > Response > > > > > Headers: > > > > > None > > > > > -- > > > 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. > > -- > 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. > > -- 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.
