railsapps / rails3-bootstrap-devise-cancan Goto Github PK
View Code? Open in Web Editor NEWOutdated. See the rails-devise-pundit example app for Rails 4.1.
Home Page: http://railsapps.github.io
Outdated. See the rails-devise-pundit example app for Rails 4.1.
Home Page: http://railsapps.github.io
Hey, I've been trying to use rails3-bootstrap-devise-cancan , and its great ! :D
But, when I try to add a new model just like this : rails g scaffold Post title:string body:text
And run 'rake db:migrate', it works well.
But dosen't work :/
I get this error : No route matches {:controller=>"devise/posts"}
And the question is: How to add a new model?
Thanks guys ! :D
Is config/application.yml hidden via .gitignore? That doesn't seem to be default case.
Twitter Bootstrap 2.0.3 was release today... So, what is the correct way to update the code that I cloned from here to this new version of Twitter Bootstrap?
When I try to run rake db:migrate or rake db:seed during installation I get an error message saying "rake aborted! Factory already registered: user".
Can anyone help me with this?
I followed your tutorials (which are awesome), but there's one inconsistency that's really getting me and should be updated. Your Flash message don't use the Twitter Bootstrap. Even though you reference it. When you setup "devise_error_messages!", the default for error messages with Devise forms its return doesn't use Bootstrap styling.
I'd love to know how to fix this as my app is looking kinda fugly without it. Thanks.
The password limitation is 8 characters, but, the seed.rb uses 'please' which is 6 characters.
Sorry, but
cd /opt/local/etc/openssl
says "no such file", even more, I don't have /opt directory on my MacOS 10.7.3 system. Maybe this (http://railsapps.github.com/openssl-certificate-verify-failed.html) solution works only for 10.6.8? Or, as far as I understood /opt exisit only if I use macports, so I don't (ant think some of Mac users, too).
To reproduce: start the app and make the width of the browser very narrow.
See screen shot: http://twitpic.com/9guudn
By default, in bootstrap, I see that links in .navbar have float:none.
The current design puts the navbar in the content, of which the width can be reduced
to a very small page. In that case, since the links in the navbar have float:none, they
appear under each other in an incorrect order (hiding the brand).
I was able to fix an ad-hoc solution by resetting the float:left for the navbar links.
But probably, there is a better solution ... My diff is:
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index dcfadc6..668f911 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -10,6 +10,7 @@
*
*= require_self
*= require_tree .
+ *= require_tree ./fixes
*/
/*
diff --git a/app/assets/stylesheets/fixes/navbar_fixes.css b/app/assets/stylesheets/fixes/navbar_fixes.css
new file mode 100644
index 0000000..cb86f81
--- /dev/null
+++ b/app/assets/stylesheets/fixes/navbar_fixes.css
@@ -0,0 +1,3 @@
+.navbar .nav > li > a {
+ float: left;
+}
why are you using <% if current_user.has_role? :admin %>
and not <% if can? :index, @user %>
In section https://tutorials.railsapps.org/tutorials/rails3-bootstrap-devise-cancan#authentication there is an argument for /config/initializers/devise.rb
to contain the following line
config.sign_out_via = Rails.env.test? ? :get : :delete
However commenting this line out does not trigger any (cucumber) tests to fail.
But when the line is changed to
config.sign_out_via = :delete
Then there are some cucumber tests to fail.
That is not in alignment with the explanation found in https://tutorials.railsapps.org/tutorials/rails3-bootstrap-devise-cancan#authentication
I've tried both on Windows and Ubuntu (everything up to date), getting the same error when I try to lunch the just generated application (with rails composer) with "rails s" (both Thin and Webrick):
ameft@ubuntu:~/unoscattoperlosport$ rails s
=> Booting Thin
=> Rails 3.2.11 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/decorator.rb:10:in method_missing': Factory already registered: user (FactoryGirl::DuplicateDefinitionError) from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/decorator/disallows_duplicates_registry.rb:6:in
register'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl.rb:65:in block in register_factory' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl.rb:64:in
each'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl.rb:64:in register_factory' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/syntax/default.rb:20:in
factory'
from /home/ameft/unoscattoperlosport/spec/factories/users.rb:4:in block in <top (required)>' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/syntax/default.rb:49:in
instance_eval'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/syntax/default.rb:49:in run' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/syntax/default.rb:7:in
define'
from /home/ameft/unoscattoperlosport/spec/factories/users.rb:3:in <top (required)>' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in
load'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in block in load' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in
load_dependency'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in load' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/find_definitions.rb:20:in
block (2 levels) in find_definitions'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/find_definitions.rb:19:in each' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/find_definitions.rb:19:in
block in find_definitions'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/find_definitions.rb:15:in each' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl-4.2.0/lib/factory_girl/find_definitions.rb:15:in
find_definitions'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/factory_girl_rails-4.2.0/lib/factory_girl_rails/railtie.rb:29:in block in <class:Railtie>' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:34:in
call'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:34:in execute_hook' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:43:in
block in run_load_hooks'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:42:in each' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:42:in
run_load_hooks'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/application/finisher.rb:59:in block in <module:Finisher>' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/initializable.rb:30:in
instance_exec'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/initializable.rb:30:in run' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/initializable.rb:55:in
block in run_initializers'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/initializable.rb:54:in each' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/initializable.rb:54:in
run_initializers'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/application.rb:136:in initialize!' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in
method_missing'
from /home/ameft/unoscattoperlosport/config/environment.rb:5:in <top (required)>' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in
require'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in block in require' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in
load_dependency'
from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in require' from /home/ameft/unoscattoperlosport/config.ru:3:in
block in
instance_eval' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/rack-1.4.4/lib/rack/builder.rb:51:in
initialize'new' from /home/ameft/unoscattoperlosport/config.ru:in
'eval' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/rack-1.4.4/lib/rack/builder.rb:40:in
parse_file'app' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in
app'wrapped_app' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/rack-1.4.4/lib/rack/server.rb:254:in
start'start' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/commands.rb:55:in
block in <top (required)>'tap' from /home/ameft/.rvm/gems/ruby-1.9.3-p374@unoscattoperlosport/gems/railties-3.2.11/lib/rails/commands.rb:50:in
<top (required)>'require' from script/rails:6:in
'I want to use Sourcegraph for rails3-bootstrap-devise-cancan code search, browsing, and usage examples. Can an admin enable Sourcegraph for this repository? Just go to https://sourcegraph.com/github.com/RailsApps/rails3-bootstrap-devise-cancan. (It should only take 30 seconds.)
Thank you!
When user signs up via "Request Invitation" , if there's an error such as duplicate email, RegistrationController.create doesn't return an xhr.error
(render(:partial => 'thankyou', :layout => false) && return) if request.xhr?
And thus this code in application.js doesn't handle error correctly.
$.ajax({
type: "POST",
url: "/users",
data: dataString,
success: function(data) {
$('#request-invite').html(data);
loadSocial();
},
});
and this isn't called:
if ($('.alert-error').length > 0) {
$("#request-invite").modal('toggle');
}
How would you go about creating different registration forms that would map to each role? I know that with devise you can create multiple user models but that kind of defeats the purpose of cancan/roles.
Thanks!
Hello,
First of all, thank you for your great tutorials and example applications.
I am looking for a new example using devise, cancan and doorkeeper or other OAuth implementation.
In other words, here are my needs:
I hope you have understood my request and I am sure it will be useful for others.
Feel free to contact me for any other information.
Jocelyn Duc
Please Zeus gem for faster booting rails server on development system.
Hi all,
When I run the command "rails new myapp -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-bootstrap-devise-cancan-template.rb -T"
I get following error:
"apply https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-bootstrap-devise-cancan-template.rb
/lib/ruby/1.9.1/net/http.rb:762:in `initialize': getaddrinfo: No such host is known. (SocketError)"
How can I fix this?
Regards,
Udo
After I cloned this from GitHub, I found that it is missing the database.yml file form the Config folder.
Here is the error message I got when running the app for the first time:
"No such file or directory - /Users/matt/Repos/rails3-bootstrap-devise-cancan/config/database.yml"
So, I just copied a version of that file from a regular default Rails app, and then it worked fine.
"As a Rails developer, you don’t have to add the X-UA-Compatible metatag to your application layout files or set an HTTP header in your ApplicationController."
I would like users to only be able to have one role. Your sample app does that. Copying the code to my app, I get multiple roles per user. I can't see where your sample app stops there from being more than one users_roles record per user.
I figured it out - you can delete this.
Hi Guys,
I've cloned the project fine, run bundle update, then try rake db:create. Its aborting rake pointing me to the config/application.erb file to this line saying invalid address. The line that causes the error is:
Bundler.require(*Rails.groups(:assets => %w(development test)))
Any ideas?
Hi,
When I create a simple mailer, I get following issue:
"stack level too deep" in "actionpack (3.2.5) lib/action_dispatch/middleware/reloader.rb:70".
What is the root cause of this issue?
Regards,
Udo
In README.textile, there are many dead links which start with http://railsapps.github.com/
.
I have compared my hand coded version of the app with a clone from GitHub. I wasn't able to notice any significant differences.
When I am on the /users page, the 'Change Role' button does nothing. The address bar changes to, "http://localhost:3000/users#role-options-2" but I don't see any sort of overlay.
Any ideas?
Hi,
i have cloned your tutorial git clone git://github.com/RailsApps/rails3-bootstrap-devise-cancan.git myApp
After this i changed into this directory running rake db:migrate and rake:db seed
After running rails s this error appears:
/Users/sebastian/.rvm/gems/ruby-1.9.3-p194@rails3-bootstrap-devise-cancan/gems/sqlite3- >1.3.6/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
I am running *ruby 1.9.3p194
What am i doing wrong?
Thx and regards,
buk
I've successfully installed a new rails app using the standard rails composer command (and hitting option 4, for rails3-bootstrap-devise-cancan). The first time, I modified application.yml accordingly, and tried both db:seed and db:reset. The user simply will not load. I tried again, this time leaving the default info in application.yml just to be sure. I see the puts messages when db:seed runs, and there are no errors, but the seed data simply will not load into the database.
If I run the app, I can create a new user without issue, but it is, of course, not an admin user. I could manually go in to the database and change the role, but I don't understand why the seed data isn't loading. Very strange! Anyone else experienced this?
1.9.3 Kevins-MacBook-Pro:/work/partners $ rails -v/work/partners $ rails new RQueuePrototype -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb -T
Rails 3.2.9
1.9.3 Kevins-MacBook-Pro:
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create app/mailers/.gitkeep
create app/models/.gitkeep
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create lib/assets
create lib/assets/.gitkeep
create log
create log/.gitkeep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create script
create script/rails
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.gitkeep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
apply https://raw.github.com/RailsApps/rails-composer/master/composer.rb
run bundle update from "."
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Installing rake (10.0.2)
Using i18n (0.6.1)
Installing multi_json (1.3.7)
Using activesupport (3.2.9)
Installing builder (3.0.4)
Using activemodel (3.2.9)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.2.1)
Using actionpack (3.2.9)
Using mime-types (1.19)
Using polyglot (0.3.3)
Installing treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.9)
Using arel (3.0.2)
Installing tzinfo (0.3.35)
Using activerecord (3.2.9)
Using activeresource (3.2.9)
Using bundler (1.1.4)
Installing coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.9)
Using coffee-rails (3.2.2)
Using jquery-rails (2.1.3)
Using rails (3.2.9)
Installing sass (3.2.3)
Using sass-rails (3.2.5)
Using sqlite3 (1.3.6)
Using uglifier (1.3.0)
Your bundle is updated! Use bundle show [gemname]
to see where a bundled gem is installed.
initializer generators.rb
composer WOOT! The recipes you've selected are known to work together.
composer Using rails_apps_composer recipes to generate an application.
insert config/application.rb
recipe Running core recipe...
core selected all core recipes
recipe Running git recipe...
git initialize git
remove .gitignore
create .gitignore
run git init from "."
Initialized empty Git repository in /Volumes/San Francisco/Users Extras/kevin/Dropbox/work/partners/RQueuePrototype/.git/
run git add -A from "."
run git commit -qm "rails_apps_composer: initial commit" from "."
recipe Running railsapps recipe...
question Install an example application?
1) I want to build my own application
2) rails-stripe-membership-saas
3) rails-prelaunch-signup
4) rails3-bootstrap-devise-cancan
5) rails3-devise-rspec-cucumber
6) rails3-mongoid-devise
7) rails3-mongoid-omniauth
8) rails3-subdomains
railsapps Enter your selection: 4
recipe Running setup recipe...
setup Your operating system is darwin12.0.0.
setup You are using Ruby version 1.9.3.
setup You are using Rails version 3.2.9.
question Web server for development?
1) WEBrick (default)
2) Thin
3) Unicorn
4) Puma
setup Enter your selection: 2
question Web server for production?
1) Same as development
2) Thin
3) Unicorn
4) Puma
setup Enter your selection: 2
question Template engine?
1) ERB
2) Haml
3) Slim (experimental)
setup Enter your selection: 2
create README
append README
recipe Running readme recipe...
recipe Running gems recipe...
gemfile thin (>= 1.5.0)
gemfile haml (>= 3.1.7)
gemfile haml-rails (>= 0.3.5)
gemfile hpricot (>= 0.8.6)
gemfile ruby_parser (>= 3.0.1)
gemfile rspec-rails (>= 2.11.4)
gemfile database_cleaner (>= 0.9.1)
gemfile email_spec (>= 1.4.0)
gemfile cucumber-rails (>= 1.3.0)
gemfile launchy (>= 2.1.2)
gemfile capybara (>= 1.1.3)
gemfile factory_girl_rails (>= 4.1.0)
gemfile bootstrap-sass (>= 2.1.1.0)
gemfile devise (>= 2.1.2)
gemfile cancan (>= 1.6.8)
gemfile rolify (>= 3.2.0)
gemfile simple_form (>= 2.0.4)
run git add -A from "."
run git commit -qm "rails_apps_composer: Gemfile" from "."
recipe Running testing recipe...
recipe Running email recipe...
recipe Running models recipe...
recipe Running controllers recipe...
recipe Running views recipe...
recipe Running routes recipe...
recipe Running frontend recipe...
recipe Running init recipe...
recipe Running prelaunch recipe...
recipe Running prelaunch recipe...
recipe Running extras recipe...
extras Set a robots.txt file to ban spiders? (y/n) n
extras Create a project-specific rvm gemset and .rvmrc? (y/n) y
extras Create a GitHub repository? (y/n) y
extras recipe setting quiet_assets for reduced asset pipeline logging
gemfile quiet_assets (>= 1.0.1)
extras recipe creating project-specific rvm gemset and .rvmrc
extras creating RVM gemset 'RQueuePrototype'
run rvm rvmrc trust from "."
Marked /Volumes/San Francisco/Users Extras/kevin/Dropbox/work/partners/RQueuePrototype/Gemfile as trusted
extras switching to gemset 'RQueuePrototype'
run rvm gemset list from "."
gemsets for ruby-1.9.3-p194 (found in /Users/kevin/.rvm/gems/ruby-1.9.3-p194)
=> RQueuePrototype
admin
blue_kai_test
edgerails-test1
global
learn_tribe
rate_card
remove .rvmrc
create .rvmrc
gsub .rvmrc
gemfile hub (>= 1.10.2)
composer Installing gems. This will take a while.
run bundle install --without production from "."
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Installing rake (10.0.2)
Installing i18n (0.6.1)
Installing multi_json (1.3.7)
Installing activesupport (3.2.9)
Installing builder (3.0.4)
Installing activemodel (3.2.9)
Installing erubis (2.7.0)
Installing journey (1.0.4)
Installing rack (1.4.1)
Installing rack-cache (1.2)
Installing rack-test (0.6.2)
Installing hike (1.2.1)
Installing tilt (1.3.3)
Installing sprockets (2.2.1)
Installing actionpack (3.2.9)
Installing mime-types (1.19)
Installing polyglot (0.3.3)
Installing treetop (1.4.12)
Installing mail (2.4.4)
Installing actionmailer (3.2.9)
Installing arel (3.0.2)
Installing tzinfo (0.3.35)
Installing activerecord (3.2.9)
Installing activeresource (3.2.9)
Installing addressable (2.3.2)
Installing bcrypt-ruby (3.0.1) with native extensions
Installing sass (3.2.3)
Installing bootstrap-sass (2.2.1.1)
Using bundler (1.1.4)
Installing cancan (1.6.8)
Installing nokogiri (1.5.5) with native extensions
Installing ffi (1.2.0) with native extensions
Installing childprocess (0.3.6)
Installing websocket (1.0.3)
Installing libwebsocket (0.1.6.1)
Installing rubyzip (0.9.9)
Installing selenium-webdriver (2.26.0)
Installing xpath (1.0.0)
Installing capybara (2.0.0)
Installing coffee-script-source (1.4.0)
Installing execjs (1.4.0)
Installing coffee-script (2.2.0)
Installing rack-ssl (1.3.2)
Installing json (1.7.5) with native extensions
Installing rdoc (3.12)
Installing thor (0.16.0)
Installing railties (3.2.9)
Installing coffee-rails (3.2.2)
Installing diff-lcs (1.1.3)
Installing gherkin (2.11.5) with native extensions
Installing cucumber (1.2.1)
Installing cucumber-rails (1.3.0)
Installing daemons (1.1.9)
Installing database_cleaner (0.9.1)
Installing orm_adapter (0.4.0)
Installing warden (1.2.1)
Installing devise (2.1.2)
Installing launchy (2.1.2)
Installing email_spec (1.4.0)
Installing eventmachine (1.0.0) with native extensions
Installing factory_girl (4.1.0)
Installing factory_girl_rails (4.1.0)
Installing haml (3.1.7)
Installing haml-rails (0.3.5)
Installing hpricot (0.8.6) with native extensions
Installing hub (1.10.2)
Installing jquery-rails (2.1.3)
Installing quiet_assets (1.0.1)
Installing rails (3.2.9)
Installing rolify (3.2.0)
Installing rspec-core (2.12.0)
Installing rspec-expectations (2.12.0)
Installing rspec-mocks (2.12.0)
Installing rspec-rails (2.12.0)
Installing sexp_processor (4.1.2)
Installing ruby_parser (3.0.1)
Installing sass-rails (3.2.5)
Installing simple_form (2.0.4)
Installing sqlite3 (1.3.6) with native extensions
Installing thin (1.5.0) with native extensions
Installing uglifier (1.3.0)
Your bundle is complete! Use bundle show [gemname]
to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
= 1.9.2 : nothing to do! Yay!
Post-install message from hub:
You there! Wait, I say!
=======================
If you are a heavy user of `git` on the command
line you may want to install `hub` the old
fashioned way. Faster startup time, you see.
Check out the installation instructions at
https://github.com/defunkt/hub#readme under the
"Standalone" section.
Cheers,
defunkt
composer Running 'after bundler' callbacks.
The template [https://raw.github.com/RailsApps/rails-composer/master/composer.rb] could not be loaded. Error: You have already activated rake 0.9.2.2, but your Gemfile requires rake 10.0.2. Using bundle exec may solve this.
Sorry I'm a huge noob, but I just generated via composer and created my own app (i.e. selected some custom options, including installing confirmable and using a PostgreSQL database), and from the start the sign up form doesn't work.
I ran rake db:migrate and rake db:seed but when I try and create a new user account via the sign up page I get "Email can't be blank" and "Password can't be blank" errors even though I've filled out all fields.
What am I doing wrong?
The user login does work for "First User" though.
Hi there,
Firstly - nice work! Am enjoying looking through some of the tutorials.
Just a quick question.. on:
http://railsapps.github.com/tutorials-rails-bootstrap-devise-cancan.html
You say "If you’ve chosen to create the application with the Devise Confirmable module, also add :confirmed_at:" to the attr_accessible.
I've run the rails_composer for this repo - added confirmable to my devise user model, generated the necessary migrations and tested (just in the browser at this stage) that I can confirm without having confirmed_at as an attr_accessible.
Just wondering if this is a documentation error (in which case I'm more than happy to submit a pull request) or if there's something obvious I'm missing.
All the best,
Patrick
The projects would be 100% if during the setup one could select items to create different combos. For instance:
Select database
1-Sqlite3
2-MySql
3-Postgresql
4-Mongoid
5-Mongodb
...
Select auth
1-none
2-Devise
3-OmniAuth
...
Select templates
1-none
2-Twitter bootstrap
3-Boilerplate
...
The example seed file suggested fails under Rails 4 RC1 with the following error and a stack trace:
Could not find table 'name'
I converted:
Role.find_or_create_by_name({ :name => role }, :without_protection => true)
to:
Role.where(:name => role).first_or_create(:without_protection => true)
Now it seems to work great.
Note that I did switch from find_or_create to first_or_create, which seemed more explicit for this context.
I had Devise up and working perfectly, but then when I went to set up CanCan and Rolify, I get this error in the browser:
NameError in Home#index
Showing C:/Sites/JustManage/app/views/devise/menu/_registration_items.html.erb where line #1 raised:
undefined local variable or method `rolify' for #<Class:0x3f48660>
Extracted source (around line #1):
1: <% if user_signed_in? %>
2:
3: <li>
4: <%= link_to('Edit registration', edit_user_registration_path) %>
Trace of template inclusion: app/views/layouts/application.html.erb
Rails.root: C:/Sites/JustManage
user.rb
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 :email, :password, :password_confirmation, :remember_me, :subdomain, :first_name, :last_name
# Make sure certain attributes are unique
validates_uniqueness_of :email, :case_sensitive => false
end
role.rb
class Role < ActiveRecord::Base
has_and_belongs_to_many :users, :join_table => :users_roles
belongs_to :resource, :polymorphic => true
scopify
end
rolify.rb
Rolify.configure do |config|
config.use_dynamic_shortcuts
end
Let me know if you need me to post any contents from other files in my project, or anything of that nature.
I did a clean git clone
and bundle install
. Any Idea?
bundle exec rake spec >!1539
/package/host/localhost/ruby-1.9.3-p0/bin/ruby -S rspec ./spec/controllers/home_controller_spec.rb ./spec/controllers/users_controller_spec.rb ./spec/models/user_spec.rb
FF..F.FF......FFFailures:
UsersController GET 'show' should find the right user
Failure/Error: @user = FactoryGirl.create(:user)
ActiveRecord::StatementInvalid:
SQLite3::SQLException: near "SAVEPOINT": syntax error: SAVEPOINT >active_record_1./spec/controllers/users_controller_spec.rb:6:in `block (2 levels) in <top (required)>'
UsersController GET 'show' should be successful
Failure/Error: @user = FactoryGirl.create(:user)
ActiveRecord::StatementInvalid:
SQLite3::SQLException: near "SAVEPOINT": syntax error: SAVEPOINT >active_record_1./spec/controllers/users_controller_spec.rb:6:in `block (2 levels) in <top (required)>'
User should reject duplicate email addresses
Failure/Error: User.create!(@attr)
ActiveRecord::StatementInvalid:
SQLite3::SQLException: near "SAVEPOINT": syntax error: SAVEPOINT >active_record_1./spec/models/user_spec.rb:40:in `block (2 levels) in <top (required)>'
User should reject email addresses identical up to case
Failure/Error: User.create!(@attr.merge(:email => upcased_email))
ActiveRecord::StatementInvalid:
SQLite3::SQLException: near "SAVEPOINT": syntax error: SAVEPOINT >active_record_1./spec/models/user_spec.rb:47:in `block (2 levels) in <top (required)>'
User should create a new instance given a valid attribute
Failure/Error: User.create!(@attr)
ActiveRecord::StatementInvalid:
SQLite3::SQLException: near "SAVEPOINT": syntax error: SAVEPOINT >active_record_1./spec/models/user_spec.rb:15:in `block (2 levels) in <top (required)>'
User password encryption should set the encrypted password attribute
Failure/Error: @user = User.create!(@attr)
ActiveRecord::StatementInvalid:
SQLite3::SQLException: near "SAVEPOINT": syntax error: SAVEPOINT >active_record_1./spec/models/user_spec.rb:90:in `block (3 levels) in <top (required)>'
User password encryption should have an encrypted password attribute
Failure/Error: @user = User.create!(@attr)
ActiveRecord::StatementInvalid:
SQLite3::SQLException: near "SAVEPOINT": syntax error: SAVEPOINT >active_record_1./spec/models/user_spec.rb:90:in `block (3 levels) in <top (required)>'
Finished in 0.83859 seconds
16 examples, 7 failuresFailed examples:
rspec ./spec/controllers/users_controller_spec.rb:17 # UsersController GET 'show' >should find the right user
rspec ./spec/controllers/users_controller_spec.rb:12 # UsersController GET 'show' >should be successful
rspec ./spec/models/user_spec.rb:39 # User should reject duplicate email addresses
rspec ./spec/models/user_spec.rb:45 # User should reject email addresses identical up to case
rspec ./spec/models/user_spec.rb:14 # User should create a new instance given a valid attribute
rspec ./spec/models/user_spec.rb:97 # User password encryption should set the encrypted password attribute
rspec ./spec/models/user_spec.rb:93 # User password encryption should have an encrypted password attributeRandomized with seed 59467
I believe this is because my dev environment is a Mac, and EC2 isn't. This creates a mismatch between the Gemfile.lock and the Gemfile
If you try to use a Twitter Bootstrap icon, it will not show up. This is an issue with the code used in the bootstrap_and_overrides.css.scss file.
These are the correct lines that need to be used in that file:
$iconSpritePath: asset-url('glyphicons-halflings.png', image);
$iconWhiteSpritePath: asset-url('glyphicons-halflings-white.png', image);
I found the fix for this issue here: twbs/bootstrap-sass#105
When running a test, I get this message:
WARNING: Cucumber-rails required outside of env.rb. The rest of loading is being defered until env.rb is called.
To avoid this warning, move 'gem cucumber-rails' under only group :test in your Gemfile
Your template has the gem in the correct place, yet it still gives this error.
I found the fix here in this cucumber-rails pull request, which was accepted:
cucumber/cucumber-rails#209
You can see from the main gem page, that you must include ":require => false" to make the error go away.
https://github.com/cucumber/cucumber-rails/blob/master/README.md
So, the line in the Gemfile should read:
gem "cucumber-rails", ">= 1.3.0", :group => :test, :require => false
Created a new rails app using:
rails new my_app -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb -T
I am missing files like seeds.rb and application.yml - is this by design or has something gone wrong?
I've tried your template under MacOS Lion, rvm, ruby 1.9.3 and got:
apply https://raw.github.com/RailsApps/rails3-application-templates/master/rails3-bootstrap-devise-cancan-template.rb
/Users/kiote/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError) from /Users/kiote/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:799:in
block in connect'
Not sure it's app issuse or my system problem, may be you know better?
Hi all,
I'm having a DEPRECATION WARNING: Model.scoped is deprecated. Please use Model.all
when using User.with_role(:admin)
on Rails 4
I use Rolify 3.2.0. I tried with Rolify 3.3.0.rc4 but I have the same issue
Someone has a solution?
thanks
Seems the rvm option always produced an error for me, even though the version used met criteria (>).
Not clear my fingers or something else.
Hi all,
I'm having a DEPRECATION WARNING
when using rake db:seed
.
This happens on user.add_role :admin
in the seed file. I cannot find how to fix it.
I have posted on http://stackoverflow.com/questions/18413012/deprecation-warning-when-using-rake-dbseed too.
Currently, after cloning the example app, a test error is emitted:
Feature: Sign in
Scenario: User is not signed up # features/users/sign_in.feature:6
And I should be signed out # features/step_definitions/user_steps.rb:142
undefined method `flatten' for nil:NilClass (NoMethodError)
/home/mark/.rvm/gems/ruby-1.9.3-p392@global/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:348:in `rollback_transaction_records'
/home/mark/.rvm/gems/ruby-1.9.3-p392@global/gems/database_cleaner-1.0.0.RC1/lib/database_cleaner/active_record/transaction.rb:36:in `clean'
/home/mark/.rvm/gems/ruby-1.9.3-p392@global/gems/database_cleaner-1.0.0.RC1/lib/database_cleaner/base.rb:77:in `clean'
/home/mark/.rvm/gems/ruby-1.9.3-p392@global/gems/database_cleaner-1.0.0.RC1/lib/database_cleaner/configuration.rb:79:in `block in clean'
/home/mark/.rvm/gems/ruby-1.9.3-p392@global/gems/database_cleaner-1.0.0.RC1/lib/database_cleaner/configuration.rb:79:in `each'
/home/mark/.rvm/gems/ruby-1.9.3-p392@global/gems/database_cleaner-1.0.0.RC1/lib/database_cleaner/configuration.rb:79:in `clean'
/home/mark/.rvm/gems/ruby-1.9.3-p392@global/gems/cucumber-rails-1.3.1/lib/cucumber/rails/hooks/database_cleaner.rb:9:in `After'
My versions:
$ bundle exec cucumber --version
1.2.3
$ bundle exec rails -v
Rails 3.2.13
$ bundle exec ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [i686-linux]
Hi,
How can I use VIP role ?
Like this: before_filter :authenticate_VIP!, :only => :new
Thank you in advance
ArgumentError - Invalid route name, already in use: 'root'
You may have defined two routes with the same name using the:as
option, or you may be overriding a route already defined by a resource with the same naming.
The issue is this suggested code:
authenticated :user do
root :to => 'users#index'
end
root :to => 'home#index'
I got my routes working by adding a named route:
authenticated :user do
root :to => 'users#index', as: :authenticated_root
end
root :to => 'home#index'
There is a change in Rails 4 which has been acknowledged by the core team:
Can you add to the tutorial how to have the currently assigned role for the user to be selected when you click change role?
If I am creating another user after default admin user(created by seed) and gives User.first or User.last in "rails c", it gives me second user in the users table and not the admin user. I am using Postgresql.
1.9.3-p327 :028 > User.all
User Load (0.8ms) SELECT "users".* FROM "users"
=> [User id: 2, email: "something", encrypted_password: "something", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2013-06-22 06:42:25", last_sign_in_at: "2013-06-22 06:42:25", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2013-06-22 06:42:25", updated_at: "2013-06-22 06:42:25", name: "something",
User id: 1, email: "[email protected]", encrypted_password: "something", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 2, current_sign_in_at: "2013-06-22 06:43:28", last_sign_in_at: "2013-06-22 06:38:35", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2013-06-22 06:37:51", updated_at: "2013-06-22 06:43:28", name: "Dharin Rajgor"]
and now
1.9.3-p327 :029 > User.first
User Load (0.9ms) SELECT "users".* FROM "users" LIMIT 1
=> User id: 2, email: "something", encrypted_password: "something", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2013-06-22 06:42:25", last_sign_in_at: "2013-06-22 06:42:25", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2013-06-22 06:42:25", updated_at: "2013-06-22 06:42:25", name: "something"
1.9.3-p327 :030 > User.last
User Load (0.9ms) SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT 1
=> User id: 2, email: "something", encrypted_password: "something", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 1, current_sign_in_at: "2013-06-22 06:42:25", last_sign_in_at: "2013-06-22 06:42:25", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2013-06-22 06:42:25", updated_at: "2013-06-22 06:42:25", name: "something"
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.