Devise RPX Connectable error undefined method user_session_url - ruby-on-rails-3

I am trying to install the devise_rpx_connectable gem functionality into my application. Everything seemed to install fine but when I try to call
<%= link_to_rpx "Signin using RPX!", user_session_url %>
I get an undefined method error on user_session_url
Any ideas on what is causing this?

It turns out I had messed up on the initial generation of the devise model. I backed out and re-did it and everything started to work.

Related

gmap4rails - can't find file underscore / Gmaps is not defined

I am following the simple tutorial here: https://github.com/JonKernPA/gmaps
I keep getting the error:
couldn't find file 'underscore'
(/app/assets/javascripts/application.js:16)
with the following line highlighted:
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
I tried following the suggestions posted in
Gmaps is not defined in rails 4 + gmaps4rails 2.0.3
and I get the same error with the error with the same line highlighted.
When I try to remove the line
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
from application.html.erb, I get the error "Gmaps not found"
Any help appreciated, thanks.
Github link: https://github.com/chiefkikio/circus/
Found a solution. Had to install gem 'underscore-rails' and then bundle it and restart the rails server.
Not a tutorial project, but I use gem 'underscore-rails' (cf https://rubygems.org/gems/underscore-rails) to satisfy gmaps4rails' dependence.
The minified version of Underscore has this line at the end of the file:
//# sourceMappingURL=underscore-min.map
Chrome's developers tools will try to download underscore-min.map when encountering this line. Users won't see this error, unless they open developer tools.
If you want to get rid of this error, either add underscore-min.map to your project (https://github.com/jashkenas/underscore/blob/master/underscore-min.map) or remove that line from underscore.min.js
I also faced the issue and this is what was the reason for me:
The order of required files in my application.js was wrong. I required
//= require_tree . before gmaps. And since I didn't wait until page load in my controller_name.js file, it was loaded first, trying to use Gmaps before the latter was defined.. I thought it might help, but.. I run into another couple issues with ".. is not defined". After small research here is the solution:
wrap you whole custom js in callback for window.load event. I used it with this line:
google.maps.event.addDomListener(window, "load", callback)
Hope this will help

Error message: NameError at /users/sign_in undefined local variable or method `require_no_authentication' for #<SessionsController:0x########>

I'm working on a RoR app with Devise. When I came in to work today and tried to start up my local dev environment, RoR failed when I tried to go to the sign in page:
NameError at /users/sign_in
undefined local variable or method `require_no_authentication' for #<SessionsController:0x########>
It looks like the error is not being raised within the code we wrote, but instead from deep within the Devise gem. I'm guessing that somehow, my dev machine isn't configured right.
Here are some things I've tried to fix the bug:
I ran rake db:migrate and rake db:terraform.
I ran bundle install.
I ran rvm gemset empty and bundle install to reinstall all of my gems.
None of these worked.
In addition, here are a couple more strange things about this error:
None of the other devs at my workplace are having the same error, even though they're on the same codebase.
After trying to figure out the error for a while, I switched to a branch that I haven't updated since before I started getting this bug. Even though it was working before the weekend, that branch now fails with the same error.
Does anybody know anything I could do to try to fix this error? Does it sound like some part of my local configuration is incorrectly set up?
In my project, I had added a file in app/controllers called devise_controller.rb. It looked like this:
class DeviseController < ApplicationController
# Asks Devise how much time is left until the current user is
# automatically logged out, without resetting the logout timer.
def time_until_logout
raise "let's inspect here"
end
end
When I deleted this file, the bug went away.
I filed a bug report about how adding a DeviseController caused RoR/Devise to blow up on Devise's repository: https://github.com/plataformatec/devise/issues/2520

CKeditor in Ruby on Rails

I installed Ckeditor following the instruction in this repository
I created a simple rails application adding
gem 'ckeditor'
to the Gemfile and then running bundle install from command line.
I created a scaffold with only one text field. I wanted to have a cktext_area rather than a normal text_area in the create/update action.
However, I get this error
undefined method 'cktext_area' for #<ActionView::Helpers::FormBuilder:0xb66fe5a8>
if I substitute the form text area with this
<%= javascript_include_tag :ckeditor %>
<%= f.cktext_area :name%>
I ran the installation as written in github, it seems it isn't able to find the appropriate helper. Even if I try to insert cktext_area_tag("test_area", "Ckeditor") it isn't able to find the correct helper.
I'm using Rails 3.1.3
Hey first I also got this error and then when i restarted the server everything worked fine.
Try it.Hope it gets working.

Rails Active Admin resource problem

I recently have watched railscast 284 about active admin and wanted to implement it into my web app, however I am running into an issue when I add a resource. I get the following message every time I try to navigate to the created tab:
NameError in Admin::LoadsController#index
undefined local variable or method `per' for []:ActiveRecord::Relation
Rails.root: /Users/thomascioppettini/rails_projects/want-freight
Application Trace | Framework Trace | Full Trace
Request
Parameters:
{"order"=>"id_desc"}
Show session dump
Show env dump
Response
Headers:
None
The only thing I can think of that may affect the application is adding a recaptcha to devise, which active admin depends on.
For me, it looks like this is a pagination problem. What gem are you using? You should give as more details about your settup. Can you show us your resource file from admin directory? What version of rails and what ActiveAdmin are you using ?
If you are using the will_paginate gem, set the version to 3.0.pre2. I was using ~>3.0.pre2, which auto-updated to 3.0.2 when I ran a bundle update Reverting fixed the issue. If you're using Bundler, the line is this:
gem "will_paginate", "3.0.pre2"
I agree with Dawaid. It is a pagiantion error. Add "Kaminari" gem to you Gemfile. According to active admin docs, it is using kaminari for pagination.. will_paginate will also work for you as swilliams described...
As I understand active_admin doesn't support will_paginate anymore. But if you don't want to rewrite your pagination to Kaminari you can fix this problem with putting some code to initializers
# config/initializers/will_paginate.rb
if defined?(WillPaginate)
module WillPaginate
module ActiveRecord
module RelationMethods
alias_method :per, :per_page
alias_method :num_pages, :total_pages
end
end
end
end
module ActiveRecord
class Relation
alias_method :total_count, :count
end
end

metasearch undefined search method

I am working on a rails 3 app, I am trying to use the meta_search gem.
After adding the gem to the GemFile and running bundle install, it seems that there is no search method.
undefined method `search' for #<Class:0x00000104134458>
I am using something similar to the examples:
#search = Bill.search(params[:search])
#bills = #search.all
Anyone experienced this before?
Well it seems that the problem was between the chair and the keyboard.
I have forgotten to restart the server. After doing so it worked flawlessly.