RailsCasts Pro episodes are now free!

Learn more or hide this

Fabricio Flores's Profile

GitHub User: fabricioflores

Site: fabricioflores.wordpress.com

Comments by Fabricio Flores

Avatar

I don't know if you still need... I used with strong parameters with this:

ruby
def self.import(file)
    CSV.foreach(file.path, headers: true) do |row|
      product = find_by_id(row["id"]) || new
      parameters = ActionController::Parameters.new(row.to_hash)
      product.update(parameters.permit(:name,:price))
      product.save!
    end
  end

and it worked. I don't know if it is optimal

Avatar

hello all. I tried to use sorcery with backbone.js. I have written API in rails but I guess I have to add the before_filter :require_login in controllers that are part of the API. The problem is that I get an error
> WARNING: Can not Verify CSRF token authenticity
> Redirected to http://localhost:3000/
> Filter chain halted as: require_login rendered or redirected
> Completed 302 Found in 2ms (ActiveRecord: 0.0ms)