MiniTest has evolved significantly since this tutorial was created. There are changes in configuration, and to help clarify the differences between the 3 main test frameworks I wrote a guide that examines their specific characteristics.
Here is a link to Ruby Reflections where you can find configuration for Rails 4.1 Test::Unit, MiniTest, Rspec, and combined with fixtures or factories. Pattern Objects, mocking, stubbing, and debugging hints are also covered.
Database cleaner is also explained, when it is necessary and when it is not.
could u solved this problem? when i run '$irb' ,give me a message 'Unable to load pry', when i run '$require 'pry'' i got
"LoadError: no such file to load -- pry
from (irb):1:in `require'
from (irb):1
"
how could i fix it how could i use pry instead rib
could u solved this problem? when i run '$irb' ,give me a message 'Unable to load pry', when i run '$require 'pry'' i got
"LoadError: no such file to load -- pry
from (irb):1:in `require'
from (irb):1
"
how could i fix it how could i use pry instead rib
ArgumentError at /
The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option?
You can get the dimension of the img using
img.columns, img.rows
I ended up doing something like this to prevent blurring of the cropped image:
ruby
defcropif model.crop_x.present?
#resize_to_limit(300, 3000)
manipulate! do |img|
converted_h = 300.0*img.rows/img.columns
x = (model.crop_x.to_i/300.0*img.columns).to_i
y = (model.crop_y.to_i/converted_h*img.rows).to_i
w = (model.crop_w.to_i/300.0*img.columns).to_i
h = (model.crop_h.to_i/converted_h*img.rows).to_i
#img.crop("#{w}x#{h}+#{x}+#{y}")
img.crop!(x, y, w, h)
img
endendend
Assuming the reason is for viewing it yourself in a browser, the easiest (and general fix) is to use a nice browser plugin. There are two plugins both named "JSONView" for Chrome and Firefox. I use the Chrome one. Very nice tool for viewing JSON API responses.
when I tail the development log, I see this error message:
Started POST "/admin/sections" for 127.0.0.1 at 2014-11-13 20:49:51 +0100
Processing by Admin::SectionsController#create as /
Parameters: {"section"=>["3", "4", "6", "2", "5"]}
Completed 500 Internal Server Error in 1ms
I'm trying to implement sortable rows in my Rails 4 application. For some reason dragging a row doesn't save the position in the database. I'm not sure whether the sort action method gets called.
When I check the Javascript console with Google developer tools no Javascript errors are thrown, so I'm not sure what's the problem.
I'm not sure if heroku allows cron jobs or not but I had a similar issue with Passenger going to sleep after inactivity on a low traffic app. So in my crontab I added the following:
This will issue a GET request every 5 minutes to your host and keep the app spun up. Note we output the results of wget to /dev/null to avoid any files being created on the server. Works like a charm.
One issue I am having at the moment is that when i search i get the new results fine but the new paginated links do not go anywhere, they just fire a get request
I am getting
tasks_count is marked as readonly
while running migration. Fixed with solution given on SOThrere's a typo for a link in the ASCIIcast. In http://railscasts.com/episodes/279-understanding-the-asset-pipeline?view=asciicast in the first paragraph, "http://ryanbigg.com/guides/asset_pipeline.html" should be "http://guides.rubyonrails.org/asset_pipeline.html"
But that doesn't diminish the goodness of the episode -- thanks!
Another great tutorial by Ryan!
MiniTest has evolved significantly since this tutorial was created. There are changes in configuration, and to help clarify the differences between the 3 main test frameworks I wrote a guide that examines their specific characteristics.
Here is a link to Ruby Reflections where you can find configuration for Rails 4.1 Test::Unit, MiniTest, Rspec, and combined with fixtures or factories. Pattern Objects, mocking, stubbing, and debugging hints are also covered.
Database cleaner is also explained, when it is necessary and when it is not.
Hi otagi I get this error OpenURI::HTTPError 403 Forbidden
could u solved this problem? when i run '$irb' ,give me a message 'Unable to load pry', when i run '$require 'pry'' i got
"LoadError: no such file to load -- pry
from (irb):1:in `require'
from (irb):1
"
how could i fix it how could i use pry instead rib
could u solved this problem? when i run '$irb' ,give me a message 'Unable to load pry', when i run '$require 'pry'' i got
"LoadError: no such file to load -- pry
from (irb):1:in `require'
from (irb):1
"
how could i fix it how could i use pry instead rib
could u solved this problem? i didn't resolve, could u tell me, how can i do?
Hey everybody. It's 2014, and as this episode is > 2 years old, a couple things have changed with the jquery-ui-rails gem:
//= require jquery-ui/datepicker
Source: https://github.com/joliss/jquery-ui-rails
I hope that helps someone... :)
Working around unrelated objects can be tad tricky at times. Just the right info to get it done, fast.
Hey. Thanks a lot for the timely info.
Great work!
Really helped me a lot. Thanks.
In rails 4, you now need to change the where() method parameters explicitly as hashes. This won't work
You need to change it to
Hey Ryan,
Just wanted to mention you misspelled the gem name in the ASCIICast:
You put:
gem 'hrpicot'
It should be:
gem 'hpricot'
(Note the switch of hrp with hpr)
Great tutorial as always!
Just a heads up for those in Rails 4, I got stuck because of 1 thing:
the "find_or_create_by" method has been deprecated in rails 4
so instead of this
try this
source: http://stackoverflow.com/a/3046645/4195073
Hope that helps someone!
I would like to know this as well. +1
I'm using this to insert an S3 image into a table cell:
Then just call
image_cell
in your table data array:[ [ image_cell(url), ... ], [ ... ] ]
.Don't touch rjs with a ten foot pole any more. It's completely deprecated and will break.
have you found solution to this? can you send how you integrted it with active admin? thanks!
Looking for a way to add to my Table a remote image from s3 to my prawn pdf.
If anyone is interested in a more up-to-date video tutorial, I created one at http://www.rubytreesoftware.com/courses/deploy-ruby-on-rails-tutorial.
Stripe now available in the UK. And yes, this is by far the simplest payment system out there. Excellent cast as ever
I was facing the same issue and this solved it. thanks David.
I am trying to validate subdomain in Rails 4 but getting exception, can anyone plz help me ?
Error Message
You can get the dimension of the img using
img.columns, img.rows
I ended up doing something like this to prevent blurring of the cropped image:
**Noticed this was from 2 years ago...
This is late, but a tip for others...
Assuming the reason is for viewing it yourself in a browser, the easiest (and general fix) is to use a nice browser plugin. There are two plugins both named "JSONView" for Chrome and Firefox. I use the Chrome one. Very nice tool for viewing JSON API responses.
Raygun is yet another option.
Does the
exception_notification
gem send notifications for rescued exceptions?Edit: You have to explicitly send notifications for rescued exceptions.
Thank you for another cast.
Have a nice day
Hospedagem de sites
Really wish I had watched this a long time ago. Sorted out a bunch of muddled thoughts in my head. Superb
Had to remove
require iconv
fromconfig/application.rb
to make this compile (with either ruby 1.9.2 or 2.0.0).Most works fine, but when reading back the xsl file written with the example, I will get
OLE2 signature is invalid
Ok, I learned that this is a format problem (still think it's funny that I writes a format it cannot read).
So I open the xls file with libreoffice, and save it as 2007 xls.
Now I can read the file (no OLE problem anymore), but I get
Row 2: Price can't be blank
and so forth for every other line.
When opening the file from libreoffice, it has the prices in the price row.
I have one question. if I want to have the autocomplete-source to return more than one attribute. how do i handle that?
As the following:
where("firstname ilike :q or lastname ilike :q ", q: "%#{query}%")
Thanks Ryan for this great episode. We are waiting for your comeback.
Hello!
Please help!
I got this error: https://www.evernote.com/shard/s447/sh/bc54becd-2c39-4ec7-b139-f9defc7651f0/9caea62319ac2ecad30ac0738931a649
@Solomon Thank you for posting this here. I've been looking for it for a while!
hi
when I tail the development log, I see this error message:
Started POST "/admin/sections" for 127.0.0.1 at 2014-11-13 20:49:51 +0100
Processing by Admin::SectionsController#create as /
Parameters: {"section"=>["3", "4", "6", "2", "5"]}
Completed 500 Internal Server Error in 1ms
NoMethodError (undefined method
permit' for ["3", "4", "6", "2", "5"]:Array):
section_params'app/controllers/admin/sections_controller.rb:54:in
app/controllers/admin/sections_controller.rb:15:in `create'
I'm trying to implement sortable rows in my Rails 4 application. For some reason dragging a row doesn't save the position in the database. I'm not sure whether the sort action method gets called.
When I check the Javascript console with Google developer tools no Javascript errors are thrown, so I'm not sure what's the problem.
My code is at:
https://github.com/acandael/beautysalonapp2/tree/drag-and-drop
anyone else got issues implement this drag and drop functionality for a Rails 4 application?
thanks for your help,
Anthony
this was a life saver thanks!
An interesting article for future visitors:
http://blog.arkency.com/2013/12/rails4-preloading/
oh man thanx so much for this
I can't get it to work. Been trying for four days now... I'm so close with this tutorial, but I can't get it finished.
I try cap deploy:cold and get
failed: "sh -c 'cd /home/deployer/apps/arcane/releases/20141113053658 && bundle install --gemfile /home/deployer/apps/arcane/releases/20141113053658/Gemfile --path /home/deployer/apps/arcane/shared/bundle --deployment --quiet --without development test'" on 173.230.151.17
I'm using Capistrano 2.15, but I don't even know where the problem lies because theres so many different things... Any ideas?
I would recommend to override the should_generate_new_friendly_id? method, because it will only change the slug when ONLY needs to do it.
I'm not sure if heroku allows cron jobs or not but I had a similar issue with Passenger going to sleep after inactivity on a low traffic app. So in my crontab I added the following:
*/5 * * * * wget -O /dev/null -o /dev/null host.domain.com
This will issue a
GET
request every 5 minutes to your host and keep the app spun up. Note we output the results of wget to /dev/null to avoid any files being created on the server. Works like a charm.Thanks !
Works with :
and :
Using Rails 4.1.7 ; very new angular user.
have you solved this issue?
Hi,
One issue I am having at the moment is that when i search i get the new results fine but the new paginated links do not go anywhere, they just fire a get request
"http://localhost:3000/public/rehome_=1415284148389&animal_town=Pontypool&animal_type=Dog&page=2&rehomed=false&utf8=%E2%9C%93"
but the content does not change
Anyone have any ideas?
I have written an article on integration testing using Capybara and RSpec, check out:Stripe Recurring Billing Part 3
Nice!