Good Luck!
Breaking the Internet
Good Luck!
— Usually an error would appear here —
Turns out the problem was pretty straight forward – it’s always the little things! I’d simply missed the each when displaying the error messages:
prohibited this message from being saved:
-
Country can’t be blank
Good Luck!
No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env[“HTTP_REFERER”].
#Redirect_to_back
def go_back
#Attempt to redirect
redirect_to :back
#Catch exception and redirect to root
rescue ActionController::RedirectBackError
redirect_to root_path
end
#Redirect user to previous page
go_back
#Redirect user to previous page
go_back
#Return to prevent multiple redirects
return
This is a problem that had me confused for an embarrassingly long time. Rails wraps button_to elements within a form and a div. Unfortunately this will take up 100% of the available width. Thankfully the solution is pretty straight forward – simply wrap buttons in a div and float them left like so:
'button'%>
'button' %>
Using the code above you may also find that the divs aren’t filling as expected, simply add a div with a ‘clear:both’ style to the bottom of the wrapper:
'button'%>'button' %>
Hopefully that doesn’t take anywhere near as long for you guys to figure out as it did me, time for a coffee break I think. Good luck!
I ran into a fairly common routing error this morning, thankfully these are fairly easy to fix – usually!
Simply add the following the route to your routes.rb file:
#Orders
controller :orders do
post ‘orders/new’ => ‘orders#new’
end
cid = 1
name = user_id
type = integer
notnull = 0
dflt_value =
pk = 0
cid = 3
name = created_at
type = datetime
notnull = 0
dflt_value =
pk = 0
Good Luck!
Well, looks like the first thing I’ve managed to break today is WEBrick – a web server for ruby on rails. The general idea behind the error message appears to be that the address it’s trying to start is already in use: