Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

nifty:authentication --help logged_in? error #151

Open
carusso opened this issue May 1, 2012 · 6 comments
Open

nifty:authentication --help logged_in? error #151

carusso opened this issue May 1, 2012 · 6 comments

Comments

@carusso
Copy link

carusso commented May 1, 2012

Just created a new rvm install of ruby-1.9.3-p194 with only the Rails 3.2.3 gems and nifty-generator (and whatever dependencies came in for those things after I did a bundle install)

Issued a "rails g nifty:authentication --help" and the following output appeared:

Usage:
rails generate nifty:authentication [user_name] [sessions_controller_name] [options]

Options:
[--haml] # Generate HAML views instead of ERB.
[--authlogic] # Use Authlogic for authentication.

Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend] # Run but do not make any changes
-q, [--quiet] # Supress status output
-s, [--skip] # Skip files that already exist

Test framework options:
[--testunit] # Use test/unit for test files.
[--rspec] # Use RSpec for test files.
[--shoulda] # Use shoulda for test files.

(erb):37:in desc': undefined methodlogged_in?' for Nifty::Generators::AuthenticationGenerator:Class (NoMethodError)
from /Users/crusso/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/erb.rb:838:in eval' from /Users/crusso/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/erb.rb:838:inresult'
from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/railties-3.2.3/lib/rails/generators/base.rb:37:in desc' from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/thor-0.14.6/lib/thor/group.rb:35:inhelp'
from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/thor-0.14.6/lib/thor/group.rb:216:in dispatch' from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/thor-0.14.6/lib/thor/base.rb:389:instart'
from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/railties-3.2.3/lib/rails/generators.rb:170:in invoke' from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/railties-3.2.3/lib/rails/commands/generate.rb:12:in<top (required)>'
from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in require' from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:inblock in require'
from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in load_dependency' from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:inrequire'
from /Users/crusso/.rvm/gems/ruby-1.9.3-p194@rentals/gems/railties-3.2.3/lib/rails/commands.rb:29:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

@adnanayn
Copy link

I'm also facing this same issue.

@ZaiLynch
Copy link

same here on Rails 3.2.6 and Ruby 1.9.3p0

@mdalziel
Copy link

I believe the issue is the usage doc does not escape the code

/lib/generators/nifty/authentication/USAGE

  <% if logged_in? %>
    Welcome <%= current_user.username %>! Not you?
    <%= link_to "Log out", logout_path %>
  <% else %>
    <%= link_to "Sign up", signup_path %> or
    <%= link_to "log in", login_path %>.
  <% end %>

Should be

  <%% if logged_in? %>
    Welcome <%%= current_user.username %>! Not you?
    <%%= link_to "Log out", logout_path %>
  <%% else %>
    <%%= link_to "Sign up", signup_path %> or
    <%%= link_to "log in", login_path %>.
  <%% end %>

@jonahbron
Copy link

👍

@minhson-kaist
Copy link

great!

@WolfieWhite
Copy link

Sorry, when I add the extra %% it shows up with the text "<% if logged_in? %>
Welcome <%= current_user.username %>! Not you?" in the view on the server site (localhost:3000).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants