Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devise dose not generate a right user model #35

Closed
rjpbonnal opened this issue May 12, 2012 · 14 comments
Closed

devise dose not generate a right user model #35

rjpbonnal opened this issue May 12, 2012 · 14 comments

Comments

@rjpbonnal
Copy link

note the end attached to remember_me
I suppose devise substitutes everything inside without giving the right space

class User < ActiveRecord::Base

Include default devise modules. Others available are:

:token_authenticatable, :confirmable,

:lockable, :timeoutable and :omniauthable

devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable

Setup accessible (or protected) attributes for your model

attr_accessible :email, :password, :password_confirmation, :remember_meend


I just added after generate 'devise user'

gsub_file 'app/models/user.rb', /end/ do

<<-RUBY

end
RUBY
end

and fixed it

@DanielKehoe
Copy link
Member

Which template are you using? I tried with rails3-devise-rspec-cucumber and wasn't able to reproduce the problem. I updated the templates last night. Not sure if this is a problem with the old version or the newest version. Could you try again and tell me if you still see the problem?

-- Daniel

@rjpbonnal
Copy link
Author

Hi Daniel, I'm using rails3-devise-rspec-cucumber with osx band rvm
Now I am afk I'll try later
Thanks

Il giorno 13/mag/2012 01:28, "Daniel Kehoe" <
reply@reply.github.com>
ha scritto:

Which template are you using? I tried with rails3-devise-rspec-cucumber
and wasn't able to reproduce the problem. I updated the templates last
night. Not sure if this is a problem with the old version or the newest
version. Could you try again and tell me if you still see the problem?

-- Daniel


Reply to this email directly or view it on GitHub:

#35 (comment)

@eicca
Copy link

eicca commented May 13, 2012

Hello.

I met today with the same problem when using rails3-bootstrap-devise-cancan-template.rb
ruby 1.9.3p125 [x86_64-darwin11.3.0]

This error occurs when the devise creates a User model.

I made a monkey patch, as well as helios: https://github.com/eicca/rails3-application-templates/commits/patch-1

@DanielKehoe
Copy link
Member

Thanks for the patches but since the templates are generated by rails_apps_composer gem, I need to identify which recipe has the bug and patch rails_apps_composer so the bug doesn't come back in the next revision of the templates. Could you tell me which preferences/options you selected when you generated your app from the template? Thank you.

@eicca
Copy link

eicca commented May 13, 2012

I showed a link to a fork because I thought it make easier to find you a place where there is an error. I understand that this is the wrong solution. I made it temporarily for their own needs (sorry for the misunderstanding, github automatically names fork like "patch-n", when you change the code in web interface).

My options:

haml  Would you like to use Haml instead of ERB? (y/n) y
rspec  Would you like to use RSpec instead of TestUnit? (y/n) y
rspec  Would you like to use factory_girl for test fixtures with RSpec? (y/n) y
rspec  Would you like to use machinist for test fixtures with RSpec? (y/n) n
cucumber  Would you like to use Cucumber for your BDD? (y/n) y
guard  Enter your selection: 2
action_mailer  Would you like the app to use a GMail account to send email? (y/n) n
devise  Enter your selection: 2
devise  Would you like to manage authorization with CanCan & Rolify? (y/n) y
html5  Enter your selection: 4
simple_form  Enter your selection: 3
extras  Would you like to use 'rails-footnotes' (it's SLOW!)? (y/n) n
extras  Would you like to set a robots.txt file to ban spiders? (y/n) y
extras  Would you like to add 'will_paginate' for pagination? (y/n) n
extras  Add 'therubyracer' JavaScript runtime (for Linux users without node.js)? (y/n) n

@rjpbonnal
Copy link
Author

Sa me options . The "wrong" row id: devise user
Il giorno 13/mag/2012 19:19, "eicca" <
reply@reply.github.com>
ha scritto:

I showed a link to a fork because I thought it make easier to find you a
place where there is an error. I understand that this is the wrong
solution. I made it temporarily for their own needs (sorry for the
misunderstanding, github automatically names fork like "patch-n", when you
change the code in web interface).

My options:

haml Would you like to use Haml instead of ERB? (y/n) y
rspec Would you like to use RSpec instead of TestUnit? (y/n) y
rspec Would you like to use factory_girl for test fixtures with
RSpec? (y/n) y
rspec Would you like to use machinist for test fixtures with RSpec?
(y/n) n
cucumber Would you like to use Cucumber for your BDD? (y/n) y
guard Enter your selection: 2
action_mailer Would you like the app to use a GMail account to send
email? (y/n) n
devise Enter your selection: 2
devise Would you like to manage authorization with CanCan & Rolify?
(y/n) y
html5 Enter your selection: 4
simple_form Enter your selection: 3
extras Would you like to use 'rails-footnotes' (it's SLOW!)? (y/n) n
extras Would you like to set a robots.txt file to ban spiders? (y/n) y
extras Would you like to add 'will_paginate' for pagination? (y/n) n
extras Add 'therubyracer' JavaScript runtime (for Linux users without
node.js)? (y/n) n


Reply to this email directly or view it on GitHub:

#35 (comment)

@DanielKehoe
Copy link
Member

@eicca and @helios I'm scratching my head because I can't reproduce the error. I tried

rails new myapp -m https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-devise-rspec-cucumber-template.rb -T

with the preferences you detailed above and app/models/user.rb looks like this for me:

class User < ActiveRecord::Base
    rolify
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :name, :email, :password, :password_confirmation, :remember_me  
end

I hesitate to add the workaround patch without first identifying the source of the error.

Are you both using ruby 1.9.3p125? That could be it. I'm using ruby-1.9.3-p194.

@rjpbonnal
Copy link
Author

Ok tomorrow ill try to reinstall everything from scratch
Il giorno 13/mag/2012 21:51, "Daniel Kehoe" <
reply@reply.github.com>
ha scritto:

@eicca and @helios I'm scratching my head because I can't reproduce the
error. I tried

rails new myapp -m
https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-devise-rspec-cucumber-template.rb-T

with the preferences you detailed above and app/models/user.rb looks
like this for me:

class User < ActiveRecord::Base
       rolify
 # Include default devise modules. Others available are:
 # :token_authenticatable, :confirmable,
 # :lockable, :timeoutable and :omniauthable
 devise :database_authenticatable, :registerable,
        :recoverable, :rememberable, :trackable, :validatable

 # Setup accessible (or protected) attributes for your model
 attr_accessible :name, :email, :password, :password_confirmation,
:remember_me
end

I hesitate to add the workaround patch without first identifying the
source of the error.


Reply to this email directly or view it on GitHub:

#35 (comment)

@DanielKehoe
Copy link
Member

Oh, no don't do that! I've just released new versions of the application templates. @eicca and @helios could you please try to generate your apps again with the same environment and let me know if you see the error. I've added a patch that should catch the error if it happens.

@rjpbonnal
Copy link
Author

Hi Daniel,
you can find the dump here:
https://gist.github.com/2692052
and https://gist.github.com/2692055 the list of my gems

@eicca
Copy link

eicca commented May 14, 2012

Daniel, I tried to generate a new version with the same options. Here is the resulting log: https://gist.github.com/2692052
I think the error occurs because fix goes after the cancan generation.

I think the problem is in devise. I tried a new application with the devise 2.1.0.rc2. When a new user generated I got the same error with the wrong end. When I changed the devise version to 2.0 - the problem disappeared.

I will try to address this problem to devise issues.
At now I think it would be right to just use the latest stable version.

heartcombo/devise#1851

@eicca
Copy link

eicca commented May 22, 2012

I tried again recently. Now it works fine.

I think you can close this issue. Many thanks for this useful templates.

@DanielKehoe
Copy link
Member

Yes, the issue was a bug in the Devise 2.1.0.rc2 release. No problems with the Devise 2.1.0 final.

@rjpbonnal
Copy link
Author

Thanks
Il giorno 22/mag/2012 20:21, "Daniel Kehoe" <
reply@reply.github.com>
ha scritto:

Yes, the issue was a bug in the Devise 2.1.0.rc2 release. No problems with
the Devise 2.1.0 final.


Reply to this email directly or view it on GitHub:

#35 (comment)

zealot128 pushed a commit to zealot128-os/rails-composer that referenced this issue Apr 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants