RailsCasts Pro episodes are now free!

Learn more or hide this

Nicolai Seerup's Profile

GitHub User: casiodk

Site: www.soundtracktor.com

Comments by Nicolai Seerup

Avatar

Has anyone tried testing this with rspec

Avatar

remember this in user model

, :omniauth_providers => [:twitter]

Avatar

It seems that indexing columns doesn´t have any effect when you are ALSO searching against associated tables

From PGSearch :
It is possible to search columns on associated models. Note that if you do this, it will be impossible to speed up searches with database indexes. However, it is supported as a quick way to try out cross-model searching.

Anyone knows about this?

Avatar

isn´t there a typo in

[200, {"Content-Type" => "appication/json"}, [terms.to_json]]

shouldn´t it be "application/json"

and how come it works anyway?

Avatar

im using spork and simple cov, and simple cov does not seem to cover everything. In my Model it says "No data available"

Any solutions to this :)

Avatar

I´m getting an Dead::Client error with phantomjs. I think it´s an issue when using fontawesome webfonts. Has anyone a solution to that?

https://github.com/jonleighton/poltergeist/issues/44

https://gist.github.com/3996516

https://gist.github.com/4003597

Avatar

you could also use the figaro gem where you define everything in an yaml file

https://github.com/laserlemon/figaro

Avatar

switched the secret access key and access key.... works

Avatar

Anybody knows what this error is about?

ruby
AuthFailure => AWS was not able to validate the provided access credentials (Fog::Compute::AWS::Error)

happens on
cap rubber:create_staging

is this supposed to be filled in

fog:
credentials:
provider: rackspace
rackspace_api_key: 'XXX'
rackspace_username: 'YYY'
image_type: 123
image_id: 123

Avatar

Hi Scott.

I need to install Libsndfile as a binary instance... How is that done, do you know?

Avatar

If you use S3 as storage

ruby
def profile_picture_geometry(style = :original)
    @geometry ||= {}
    profile_picture_path = (profile_picture.options[:storage] == :s3) ?   profile_picture.url(style) : profile_picture.path(style)
    @geometry[style] ||= Paperclip::Geometry.from_file(profile_picture_path)
end
Avatar

Is it possible only to push certain tables when using TAPS. I´m using a MYSQL DB in development, and need to transfer my users table and images table to production, which uses Postgresql.... Any suggestions?

Oh, my production database is on Heroku by the way

Avatar

Is it possible only to push certain tables when using TAPS. I´m using a MYSQL DB in development, and need to transfer my users table and images table to production, which uses Postgresql.... Any suggestions?

Avatar

The answer lies here

mercury.js
// ## Silent Mode
  //
  // Turning silent mode on will disable asking about unsaved changes before leaving the page.
  silent: false,

  // ## Debug Mode
  //
  // Turning debug mode on will log events and other various things (using console.debug if available).
  debug: false,

  // The onload method is provided as a callback in case you want to override default Mercury Editor behavior.  It will
  // be called directly after the Mercury scripts have loaded, but before anything has been initialized.  It's a good
  // place to add or change functionality.
  onload: function() {
    //Mercury.PageEditor.prototype.iframeSrc = function(url) { return '/testing'; }
    Mercury.on('ready', function() {
      var link = $('#mercury_iframe').contents().find('#edit_link');
    Mercury.saveURL = link.data('save-url');
    link.hide();
    });

    Mercury.on('saved', function() {
      window.location.href = window.location.href.replace(/\/editor\//i, '/');
    });

  }

};

https://gist.github.com/1581146

Avatar

Thats a very good way, except when validations fail. Then the id of the created OBJECT gets passed to the view, but when the validation fails, the same OBJECT gets deleted in the ROLLBACK process.

Then when you submit the form again, Rails can´t find the object based of the ID that gets passed on from the view...

Does anyone have a solution to this problem... Maybe some kind of after_validation callback?

Avatar

Hi, does anyone know how to use the snippets function?

Avatar

I haven´t got the cropper module to work with Ryans code, but this works for me

ruby
module Paperclip
  class Cropper < Thumbnail
    def transformation_command
      if crop_command
        crop_command + super.join(' ').sub(/ -crop \S+/, '').split(' ') # super returns an array like this: ["-resize", "100x", "-crop", "100x100+0+0", "+repage"]
      else
        super
      end
    end

    def crop_command
      target = @attachment.instance
      if target.cropping?
        ["-crop", "#{target.crop_w}x#{target.crop_h}+#{target.crop_x}+#{target.crop_y}"]
      end
    end
  end
end
Avatar

Hello Ryan

Great screencast.
I was wondering, is it possible to use the pjax functionality with a search button instead of a link?

Whem I try I get this

No route matches [GET] "/undefined"

Avatar

filter_parameter_logging is deprecated in rails 3.1... instead put this in application.rb

config.filter_parameters << :card_number << :card_verification

Avatar

I was wondering the same thing? I have thinking sphinx on my production server, but i think it takes a lot to always making sure its running...

Avatar

When I go to the resque interface, i don

Avatar

How would you recommend installing Redis on Ubuntu server?

Avatar

Hello.

I followed your video, and got everything working. But now when i run my search through thinking_sphinx the pagination stops working... Any thoughts on that?

Cheers