I am newbie with Shapado. I’m trying to install shapado in my laptop (MAC OS) and when I try to access to http://localhost.lan:3000 I have the following error:
NoMethodError in Questions#index
Showing /Users/sciruela/Documents/shapado/shapado/app/views/shared/_login_drop_down.html.haml where line #10 raised:
undefined method `[]' for nil:NilClass
Extracted source (around line #10):
7: = link_to provider.titleize, '/users/auth/facebook', :class => 'auth-provider Facebook', :id => 'facebook'
8: - else
9: %li
10: = link_to provider.titleize, multiauth_url(provider), :class => "auth-provider #{provider}", :id => dprovider
11:
12: -if current_group.allow_any_openid
13: %li
Trace of template inclusion: app/views/shared/_login_menu.html.haml, app/views/shared/_topbar.html.haml, app/views/layouts/application.html.haml
Rails.root: /Users/sciruela/Documents/shapado/shapado
Application Trace | Framework Trace | Full Trace
app/views/shared/_login_drop_down.html.haml:10:in `block in _app_views_shared__login_drop_down_html_haml__1123238317393261506_2159776840'
app/views/shared/_login_drop_down.html.haml:2:in `each'
app/views/shared/_login_drop_down.html.haml:2:in `_app_views_shared__login_drop_down_html_haml__1123238317393261506_2159776840'
app/views/shared/_login_menu.html.haml:6:in `_app_views_shared__login_menu_html_haml___434956048083202339_2193663100'
app/helpers/application_helper.rb:36:in `multiauth_dropdown'
app/views/shared/_topbar.html.haml:21:in `_app_views_shared__topbar_html_haml___2782218627514502243_2204427320'
app/views/layouts/application.html.haml:10:in `block in _app_views_layouts_application_html_haml___4514694021451724572_2205033860'
app/helpers/layout_helper.rb:74:in `call'
app/helpers/layout_helper.rb:74:in `block in ie_tag'
app/helpers/layout_helper.rb:72:in `ie_tag'
app/helpers/layout_helper.rb:79:in `ie_html'
app/views/layouts/application.html.haml:2:in `_app_views_layouts_application_html_haml___4514694021451724572_2205033860'
app/controllers/application_controller.rb:122:in `block (2 levels) in find_questions'
app/controllers/application_controller.rb:121:in `find_questions'
app/controllers/questions_controller.rb:67:in `index'
lib/sso_strategy.rb:18:in `call!'
app/middlewares/dynamic_domain.rb:17:in `call'
Request
How I could solve it?
Thanks
In Rails, the [] acts as a reader and []= as a setter. It looks like the issue is occurring on line 10 at multiauth_url(provider).
It also appears that provider is nil in this case. I suggest using pry (a gem) and drop in binding.pry to debug further. You might be making the assumption that a provider always exists, so verify that provider is not nil first.
did you follow shapado's Readme? seems like you did not this step
https://github.com/ricodigo/shapado/blob/master/README#L25
Related
When submitting a simple multipart form, the server crashes and displays "Internal server error".
I have scaled down the form to the minimal:
<%= form_for #media_object, :html => {:multipart => true} do |f| %>
<%= f.file_field :media_object_image %>
<%= f.submit "Create!" %>
<% end %>
The log trace:
ERROR ArgumentError: unexpected prefix: {"RackMultipart"=>nil, ""=>nil}
/Users/christer/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tmpdir.rb:111:in `make_tmpname'
/Users/christer/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tmpdir.rb:129:in `create'
/Users/christer/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tempfile.rb:132:in `initialize'
/Users/christer/.rvm/gems/ruby-2.3.0#teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:22:in `new'
/Users/christer/.rvm/gems/ruby-2.3.0#teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:22:in `block in create'
/Users/christer/.rvm/gems/ruby-2.3.0#teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:135:in `get_current_head_and_filename_and_content_type_and_name_and_body'
/Users/christer/.rvm/gems/ruby-2.3.0#teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:59:in `block in parse'
/Users/christer/.rvm/gems/ruby-2.3.0#teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:56:in `loop'
/Users/christer/.rvm/gems/ruby-2.3.0#teamhubs4/gems/rack-1.6.4/lib/rack/multipart/parser.rb:56:in `parse'
/Users/christer/.rvm/gems/ruby-2.3.0#teamhubs4/gems/rack-1.6.4/lib/rack/multipart.rb:25:in `parse_multipart'
/Users/christer/.rvm/gems/ruby-2.3.0#teamhubs4/gems/rack-1.6.4/lib/rack/request.rb:375:in `parse_multipart'
/Users/christer/.rvm/gems/ruby-2.3.0#teamhubs4/gems/rack-1.6.4/lib/rack/request.rb:207:in `POST'
Googling around turns up multipart submission problems with Rails 4.2 due to maximum number of open multipart files, but this is definitely different.
I'm running Rails 4.2.6 with Ruby 2.3.
Although I'm not using the imgur gem, Phil Ross put me on the right track. I do indeed extend the Array class with a to_hash method. Removing this extensions, and voila!, things work as they should.
imgur is not alone. dropbox gem is also known to cause this. Check your Gemfile.
I am using rails 3.2.13 and ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux] in CentOS 5.6. When I try to seed the data I got the following error.
** Execute Samp:seed:record_status
Creating RecordStatus: Active
rake aborted!
ActiveRecord::RecordNotSaved
/usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.13/lib/active_record/persistence.rb:105:in `save!'
/usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.13/lib/active_record/validations.rb:56:in `save!'
/usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.13/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
/usr/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.13/lib/active_record/transactions.rb:264:in `block in save!'
/opt/Samp/lib/tasks/seed/record_status.rake:19:in `block (4 levels) in <top (required)>'
/opt/Samp/lib/tasks/seed/record_status.rake:16:in `each'
/opt/Samp/lib/tasks/seed/record_status.rake:16:in `block (3 levels) in <top (required)>'
record_status.rake
16: record_statuses.each do |rs|
17: unless RecordStatus.find_by_seed_name(rs[:name])
18: puts "Creating RecordStatus: #{rs[:name]}"
19: RecordStatus.create!(:name => rs[:name],
20: :seed_name => rs[:name],
21: :description => rs[:description])
22: end
23: end
EDIT-1
*RecordStatus.rb*
class RecordStatus < ActiveRecord::Base
acts_as_enumerated
ACTIVE = 1
DISABLED = 2
DELETED = 3
validates_uniqueness_of :id , :name
end
It appears like you must have duplicate names in your seed data. To find out for sure, change your call to create! to something like:
rs = RecordStatus.new(...)
unless rs.save
raise "Couldn't save #{rs.inspect}: #{rs.errors.full_messages.to_sentence}"
end
Rails 3 doesn't support create/alter/destroy instances for enumerations by nature. If we wants to create any enumerations just add Model.enumeration_model_updates_permitted = true in record_status.rake file. REF : Enumerations_mixin
In ActiveAdmin 0.4.3, and Rails 3.2.2 I'm trying to customize the show screen of my Article mode
ActiveAdmin.register Article do
show do
render "show"
end
end
And in app/views/admin/articles/_show.html.haml
%div= article.description
But whenever I try to show an Article I get:
NoMethodError in Admin/articles#show
Showing /Users/phishman/Sites/wisegrowth/app/views/admin/articles/_show.html.haml where line #1 raised:
undefined method `description' for <article></article>
:Arbre::HTML::Article
Extracted source (around line #1):
1: %div= article.description
Trace of template inclusion: /Users/phishman/.rvm/gems/ruby-1.9.2-p290/gems/activeadmin-0.4.3/app/views/active_admin/resource/show.html.arb
Rails.root: /Users/phishman/Sites/wisegrowth
Application Trace | Framework Trace | Full Trace
app/views/admin/articles/_show.html.haml:1:in `_app_views_admin_articles__show_html_haml___3305533421865107600_2209712640'
app/admin/articles.rb:20:in `block (2 levels) in <top (required)>'
app/middleware/flash_session_cookie_middleware.rb:17:in `call'
Can you please help me on this? It is getting me crazy!
In the console everything seems to be working fine and if I do:
a = Article.last
a.description
=> "my article description"
Try this instead:
render :partial => "show", :locals => {:article => article }
I am trying to get basic authentication working using devise and mongomapper.
Following the instructions here:
http://johnwyles.com/2010/03/15/sessions-in-mongodb-using-mongomapper-and-devise/
(except deferring the routes.rb changes until after the generators are run to address errors)
I got it as far as getting the following paths to work:
/users/sign_up ::
/users/sign_in ::
/users/password/new ::
/users/confirmation/new
However, just trying to hit "/" gives me an error
NameError in UserController#sign_in
uninitialized constant UserController
RAILS_ROOT: /Users/bentrevino/Documents/Dev/devisetest
Application Trace | Framework Trace | Full Trace
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:443:in `load_missing_constant'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:92:in `const_missing'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/inflector.rb:364:in `constantize'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/inflector.rb:363:in `each'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/inflector.rb:363:in `constantize'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:444:in `recognize'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:437:in `call'
After I submit a sign-up request, I get this error
RuntimeError in Registrations#create
Showing /Library/Ruby/Gems/1.8/gems/devise-1.0.8/app/views/devise_mailer/confirmation_instructions.html.erb where line #5 raised:
Missing host to link to! Please provide :host parameter or set default_url_options[:host]
Extracted source (around line #5):
2:
3: <p>You can confirm your account through the link below:</p>
4:
5: <p><%= link_to 'Confirm my account', confirmation_url(#resource, :confirmation_token => #resource.confirmation_token) %></p>
Does anybody know what might be going on here?
Thanks!
Ben....
At least one issue you are having is that you have not created a controller for your root route that you specified in config/routes.rb file. Run a call to rails generate controller [name] to make a new controller. Then specify that name in your config/routes.rb file for our root route.
I am a complete newbie to the world of Ruby & Rails moving from the land of PHP & Symfony. I'm currently attempting to setup the Facebook Connect plugin & Twitter oAuth for authlogic. Authlogic works no problem but both of the others fail when I attempt to call their buttons- can someone tell me where I'm going wrong? I've put the stack trace below- thanks!
NameError in User_sessions#new
Showing app/views/user_sessions/new.html.haml where line #13 raised:
undefined local variable or method `authlogic_facebook_login_button' for #<ActionView::Base:0x1034fe9e0>
Extracted source (around line #13):
= f.text_field :password
%br
= f.submit "Login"
= authlogic_facebook_login_button
RAILS_ROOT: /Users/nick/Sites/matchmefor-2
Application Trace | Framework Trace | Full Trace
/Users/nick/Sites/matchmefor-2/app/views/user_sessions/new.html.haml:13:in `_run_haml_app47views47user_sessions47new46html46haml'
/Library/Ruby/Gems/1.8/gems/haml-2.2.9/lib/haml/helpers/action_view_mods.rb:164:in `call'
/Library/Ruby/Gems/1.8/gems/haml-2.2.9/lib/haml/helpers/action_view_mods.rb:164:in `form_for'
/Library/Ruby/Gems/1.8/gems/haml-2.2.9/lib/haml/helpers.rb:543:in `call'
/Library/Ruby/Gems/1.8/gems/haml-2.2.9/lib/haml/helpers.rb:543:in `haml_bind_proc'
/Library/Ruby/Gems/1.8/gems/haml-2.2.9/lib/haml/helpers/action_view_mods.rb:170:in `form_for'
/Users/nick/Sites/matchmefor-2/app/views/user_sessions/new.html.haml:4:in `_run_haml_app47views47user_sessions47new46html46haml'
/Library/Ruby/Gems/1.8/gems/haml-2.2.9/lib/haml/helpers/action_view_mods.rb:13:in `render'
/Library/Ruby/Gems/1.8/gems/haml-2.2.9/lib/haml/helpers/action_view_mods.rb:13:in `render'
/Library/Ruby/Gems/1.8/gems/haml-2.2.9/lib/sass/plugin/rails.rb:19:in `process