RailsCasts Pro episodes are now free!

Learn more or hide this

Thomas Bush's Profile

GitHub User: ThomasBush

Comments by Thomas Bush


Alright so I have finally solved this issue with help from stackoverflow. The issue is a conflict when combining jcrop with twitter bootstrap. The solution to my question is linked here. Its embarrassingly simple, apparently TBS sets image max width property to 100% and you simply override with with a style you create to remove this property. I was so focused on jcrop itself that I did ponder anything else causing the problem. Lesson learned, but I figured I would post for anyone elses benefit.


So I figured out most of my errors. I wasn't setting the all the values I needed to.

I set
att_accesible for crop_x , crop_y, crop_w, crop_h 
didnt set
attr_accessor for all these same values 

I guess I thought these were the same as rails seems to understand connections like user and users - dumb I know, I'm new to ruby and rails but railscasts has been teaching my quite a bit.

My only remaining issue is with the preview function which I have also asked in a stackoverflow question in great detail. But basically the image appears with a second image inside the crop window that stretches and skews as the resizing handles are moved. Any help would be greatly appreciated as this issue has haunted me for about a week now. Thanks!


I get the following error when trying to implement this tutorial. I wanted to get this work and then alter to my needs so I have not made any modifications to the original code. Any one have any suggestions? I would really appreciate the help. Thanks!

undefined method `crop_x' for #User:0x007ff7594cb2f8

Rails.root: /Users/thomasbush/Rails/college
Application Trace | Framework Trace | Full Trace

app/uploaders/avatar_uploader.rb:47:in crop'

Also not sure if this matters but my users system is set up with Devise, I handle roles and permissions with CanCan and I followed the #253 tutorial to get the basic carrierwave uploading working. All of course thanks to Ryan - railscasts is too good! Thanks.