railsapps / rails-devise Goto Github PK
View Code? Open in Web Editor NEWRails 5.0 starter app with Devise for authentication.
Home Page: http://railsapps.github.io/rails-devise/
Rails 5.0 starter app with Devise for authentication.
Home Page: http://railsapps.github.io/rails-devise/
After using the Rails Composer tool to generate a starter app, the rails server
command exits with the following error:
$ rails server
=> Booting Puma
=> Rails 5.1.4 application starting in development
=> Run `rails server -h` for more startup options
Exiting
/Users/jamesfrost/example-app/spec/factories/users.rb:1:in `<top (required)>': uninitialized constant FactoryGirl (NameError)
from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:20:in `block (2 levels) in find_definitions'
from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:19:in `each'
from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:19:in `block in find_definitions'
from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:15:in `each'
from /Library/Ruby/Gems/2.3.0/gems/factory_bot-4.8.2/lib/factory_bot/find_definitions.rb:15:in `find_definitions'
from /Library/Ruby/Gems/2.3.0/gems/factory_bot_rails-4.8.2/lib/factory_bot_rails/railtie.rb:21:in `block in <class:Railtie>'
from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:67:in `block in execute_hook'
from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each'
from /Library/Ruby/Gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:73:in `block in <module:Finisher>'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
from /Users/jamesfrost/example-app/config/environment.rb:5:in `<top (required)>'
from config.ru:3:in `require_relative'
from config.ru:3:in `block in <main>'
from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
from config.ru:in `new'
from config.ru:in `<main>'
from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:24:in `app'
from /Library/Ruby/Gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:80:in `log_to_stdout'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:42:in `start'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:135:in `block in perform'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
from /Users/jamesfrost/example-app/bin/rails:9:in `require'
from /Users/jamesfrost/example-app/bin/rails:9:in `<top (required)>'
from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
from /Library/Ruby/Gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /Users/jamesfrost/example-app/bin/spring:15:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
The FactoryGirl project has recently changed its name to FactoryBot; after replacing all references to FactoryGirl with FactoryBot, the server runs.
I plan to use Active Admin for the app I'm building but want other kinds of users/roles, e.g. ordinary user, and editor. Will the app template here work in concert with Active Admin's implementation of Devise, or is it a can of worms?
I am an intermediate web developer, but new to Rails.
Hello,
on Sqlite3 Devise worked without problem.
Now I converted db from Sqlite3 to MySQL and Rails returns error:
Mysql2::Error: Unknown column 'users.' in 'where clause': SELECT
users.* FROM
usersWHERE
users.`` = 1 LIMIT 1
in my Table is not column 'users'...I have just:
id, email, encrypted_password, reset_password_token, reset_password_sent_at, remember_created_at, sign_in_count, current_sign_in_at, last_sign_in_at, current_sign_in_ip, last_sign_in_ip, created_at, updated_at
is necessary do something more after such conversion database?
Thank You
Hi.
I tried using this Mailer configuration in my config/initializers/devise.rb
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'no-reply@' + Rails.application.secrets.domain_name
but I've got an error when trying to generate user
config/initializers/devise.rb:15:in `+': no implicit conversion of nil into String (TypeError)
I have fixed by adding the to_s
at the end of the following line.
config.mailer_sender = 'no-reply@' + Rails.application.secrets.domain_name.to_s
I thought it would be a good tip for people who still learn Rails
When running app In development, resetting password at http://localhost:3000/users/password/new yields a Net::SMTPAuthenticationError
...
Hi Just curious if anyone run rspec command on the file. mine had multiple failures. the only thing I changed was the length of password. Maybe this is expected I am a newbie, so don't know if it should fail.
i asked this on tutorial but will post here just in case
Thank you so much for this guide very helpful. I am fairly new to programming and to Rails, so not sure how much I got but will revisit the guide several times, hopefully picking up more as I go along.
I was working on a project where I had doctors, patients, and admin. All three need to sign up, sign in, etc, just curious as to how I would do this using the tools here. The way I am thinking of doing it is probably wrong, and I am sure there is a simple logical way to do it. As it is rails generates so many files so like to keep it as simple as possible
thanks
rails new my_project -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
and then followed the steps.
bundle install
at the end and
rails s
and I get this error:
Sass::SyntaxError - ".column" failed to @extend ".text-xs-center".
The selector ".text-xs-center" was not found.
Use "@extend .text-xs-center !optional" if the extend should be able to fail.
:
app/assets/stylesheets/1st_load_framework.css.scss:20:in ' sass (3.4.23) lib/sass/tree/visitors/extend.rb:62:in
block in check_extends_fired!'
sass (3.4.23) lib/sass/util/subset_map.rb:105:in block in each_value' sass (3.4.23) lib/sass/util/subset_map.rb:105:in
each'
sass (3.4.23) lib/sass/util/subset_map.rb:105:in each_value' sass (3.4.23) lib/sass/tree/visitors/extend.rb:51:in
check_extends_fired!'
sass (3.4.23) lib/sass/tree/visitors/extend.rb:16:in visit' sass (3.4.23) lib/sass/tree/root_node.rb:39:in
css_tree'
sass (3.4.23) lib/sass/tree/root_node.rb:20:in render' sass (3.4.23) lib/sass/engine.rb:281:in
render'
sass-rails (5.0.6) lib/sass/rails/template.rb:47:in `evaluate'
Right out of the box, it seems like the "name" parameter is not saving correctly.
However, this is easily fixed by adding the following to app/controllers/application_controller.rb
:
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
devise_parameter_sanitizer.permit(:account_update, keys: [:name])
end
end
Getting encoding issues when generating the app on a linux box.
(Similar issue when I clone and build the app).
Some examples:
gsub config/initializers/filter_parameter_logging.rb
generate devise:install
/usr/share/ruby/gems/2.1/gems/json-1.8.1/lib/json/pure/parser.rb:242:in rescue in parse_string': Caught Encoding::CompatibilityError at '[{"content-type":"ap': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) (JSON::ParserError) ... generate devise user /usr/share/ruby/gems/2.1/gems/json-1.8.1/lib/json/pure/parser.rb:242:in
rescue in parse_string': Caught Encoding::CompatibilityError at '[{"content-type":"ap': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) (JSON::ParserError)
...
generate migration AddNameToUsers name:string
/usr/share/ruby/gems/2.1/gems/json-1.8.1/lib/json/pure/parser.rb:242:in `rescue in parse_string': Caught Encoding::CompatibilityError at '[{"content-type":"ap': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) (JSON::ParserError)
...
run bundle exec rake db:migrate from "."
rake aborted!
JSON::ParserError: Caught Encoding::CompatibilityError at '[{"content-type":"ap': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
/home/ec2-user/.gem/ruby/2.1/gems/mime-types-2.3/lib/mime/types/loader.rb:210:in `load_from_json'
When I try to use the console to view all the users with the command User.all, I get the following error:
2.2.1 :001 > User.all
NameError: uninitialized constant User
from (irb):1
from /Users/msarr/.rvm/gems/ruby-2.2.1/gems/railties- 4.2.5.1/lib/rails/commands/console.rb:110:in start' from /Users/msarr/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5.1/lib/rails/commands/console.rb:9:in
start'
from /Users/msarr/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:68:in console' from /Users/msarr/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in
run_command!'
from /Users/msarr/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in <top (required)>' from /Users/msarr/Desktop/deployment/YouServe/bin/rails:9:in
<top (required)>'
from /Users/msarr/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /Users/msarr/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in
require'
from -e:1:in `
Once the nav bar is collapsed, the drop down menu does not open.
I am getting the following error when I try to run the custom rails configuration script. When it reads the database.yml:
YAML syntax error occurred while parsing /home/vagrant/demo/rails-devise/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): found undefined tag handle while parsing a node at line 22 column 13
Just thought I would give you guys a heads up that it looks like Puma is now the recommended Ruby Webserver rather than Unicorn on Heroku.
https://devcenter.heroku.com/changelog-items/594
I can make a PR for the Readme if you want.
Following the install for Foundation5 I'm getting this error.
Probably should tell newer Ruby devs, like me, to stay away from using JRuby with this tutorial and Composer script. If you can get past not having the better_errors gem, then you may be faced with JCE (java cryptography) issues when trying to use the sample app. Problems seemingly go away when using YARV 2.0. I also think the Devise developers state that multi-threaded usage with JRuby is not yet supported.
This is well documented at this stack overflow post - can you please take a look :
Followed instructions to generate using bootstrap 4 several times with different configurations and I always get a white homepage (invisible navbar w/ only 1 link --> to About page):
Unfortunately I have not figured out how to solve the issue.
Installing using Simple CSS or Bootstrap 3.3 works perfectly.
Since to d395efd, both DeviseController
and ApplicationController
(its parent controller) are loaded inside an initializer, before the app has been completely loaded and in scenarios where loading the app isn't necessary (like during rake db:setup
or rake routes
tasks).
This isn't recommended and it can cause different loading order bugs that are hard for developers to track down. As current Devise maintainer, I recommend moving the configure_permitted_parameters
callback back to the ApplicationController
class.
Related Devise issue - heartcombo/devise#3757
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.