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

Does not work with Rails4 #13

Open
hipertracker opened this issue Jan 26, 2013 · 5 comments
Open

Does not work with Rails4 #13

hipertracker opened this issue Jan 26, 2013 · 5 comments

Comments

@hipertracker
Copy link

The gem specs are still dependent on Rails 3 :(

@patcito
Copy link
Owner

patcito commented Jan 28, 2013

To be fair, rails4 hasn't been released yet but I'll have a look.

@kgathi2
Copy link

kgathi2 commented Mar 6, 2013

XSRF token does not get relayed properly. May be changes in rails routing

@djones
Copy link

djones commented May 19, 2013

Confirmed this is still an issue with Rails 4 rc1

@lgs
Copy link

lgs commented Jul 6, 2013

... I can install on Rails 4 ( rails g angularjs:install ) and I can create and see posts, but DELETE and EDIT don't work :

gem 'rails', '4.0.0'
gem 'angularjs_scaffold',  :git => "https://github.com/patcito/angularjs_scaffold.git"

then I can also do :

 2066  rails g scaffold Post title:string body:string
 2067  rake db:migrate
 2068  rails g angularjs:scaffold Posts

now I can create and see posts, but as soon you try to DELETE them, it fails with a routing error :

Started GET "/posts" for 127.0.0.1 at 2013-07-06 18:41:47 +0200
Processing by PostsController#index as JSON
  Post Load (0.2ms)  SELECT "posts".* FROM "posts"
  Rendered posts/index.json.jbuilder (4.5ms)
Completed 200 OK in 10ms (Views: 8.5ms | ActiveRecord: 0.2ms)
Started DELETE "/posts" for 127.0.0.1 at 2013-07-06 18:41:53 +0200
ActionController::RoutingError (No route matches [DELETE] "/posts"):
  actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/application.rb:97:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  /home/lsoave/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  /home/lsoave/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  /home/lsoave/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
  Rendered /home/lsoave/.rvm/gems/ruby-2.0.0-p0@rails-4.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.4ms)
  Rendered /home/lsoave/.rvm/gems/ruby-2.0.0-p0@rails-4.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/routes/_route.html.erb (1.9ms)
  Rendered /home/lsoave/.rvm/gems/ruby-2.0.0-p0@rails-4.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/routes/_table.html.erb (3.6ms)
  Rendered /home/lsoave/.rvm/gems/ruby-2.0.0-p0@rails-4.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (41.0ms)

as well as you try to EDIT, fails presenting an empty form instead of the corresponding post to edit :

Started GET "/assets/posts/edit.html" for 127.0.0.1 at 2013-07-06 18:43:43 +0200
Started GET "/posts" for 127.0.0.1 at 2013-07-06 18:43:43 +0200
Processing by PostsController#index as JSON
  Post Load (0.2ms)  SELECT "posts".* FROM "posts"
  Rendered posts/index.json.jbuilder (1.8ms)
Completed 200 OK in 8ms (Views: 6.0ms | ActiveRecord: 0.2ms)

@aripoya
Copy link

aripoya commented Sep 17, 2014

in rails 4 you can add some code like this:

class ApplicationController < ActionController::Base
protect_from_forgery with: :null_session,
if: Proc.new { |c| c.request.format =~ %r{application/json} }
end

this solution base from :https://coderwall.com/p/8z7z3a

Repository owner deleted a comment Feb 23, 2024
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

6 participants