gravatar_image_tag breaks after upgrading to Rails 3.1 - ruby-on-rails-3.1

I use gravatar_image_tag to generate user avatars. It works perfectly fine in Rails 3.0.10, but breaks when I upgrade to Rails 3.1.0. Unfortunately, it doesn't produce any error message/warning. It just stops showing images. I have no clue how to debug this.
I know this is very limited information, but hopefully someone who ran into this issue before may help me out.
Thank you.

I found out that in Rails 3.0, I can write:
- link_to(#user) do
= avatar_for(#user, size = 80)
but in Rails 3.1, I have to write:
= link_to(#user) do
= avatar_for(#user, size = 80)
This is the reason why gravatar_image_tag doesn't work for me after upgrading to Rails 3.1

Related

Symfony 4.4 getRepository No Longer Working

I recently updated a Symfony app to 4.4 from 4.2 and now my getRepository calls no longer work.
I was calling getting my repos like this:
$oems = $em->getRepository('App:OEM')->findAll();
After reading about the issue I changed to this:
$oems = $this->getDoctrine()->getRepository(OEM::class)->findAll();
But now I get this error:
Class "App\Controller\OEM" does not exist
Fixed it. I wasn't including the class. Added this and it worked:
use App\Entity\OEM;

Issues with Skybound.Gecko.GeckoPreferences.User

I have the following code:
Skybound.Gecko.GeckoPreferences.User("network.proxy.type") = 1
Skybound.Gecko.GeckoPreferences.User("network.proxy.share_proxy_settings") = True
Skybound.Gecko.GeckoPreferences.User("network.proxy.https") = "000.000.000.000"
Skybound.Gecko.GeckoPreferences.User("network.proxy.https_port") = 80
Skybound.Gecko.GeckoPreferences.User("network.proxy.https_remote_dns") = True
In which 000.000.000.000 is a proxy.
The problem is sometimes it works and most of the time is not affected.
How can I see if the proxy IP is affected to the network.proxy.https? Also, how can I force the change of the proxy and the port?
One other problem:
Sometimes where I am using geckowebbrowser it sends a message box with choice answer, like:
Would you really like to quit this page?
How can I escape this message box and others?
I'm fairly new to GeckoFX, but I know that in the latest version (31.0), Skybound doesn't exist anymore. You may have some luck by upgrading to the latest version. Here is the link to the repo: https://bitbucket.org/geckofx

Selenium Webdriver and Firefox 18

My Selenium tests use onMouseOver features like
List<WebElement> menuitems = getDriver().findElements(By.tagName("li"));
Actions builder = new Actions(getDriver());
WebElement menu = menuitems.get(2);
getDriver().manage().timeouts().implicitlyWait(Constants.IMPLICITY_WAIT, TimeUnit.SECONDS);
builder.moveToElement(menu).build().perform();
I'm using Firefox driver. Since Firefox updated itself to version 18, my tests stopped working. I know this has to do with native events support - but does not version 18 support native events, or am i able to enable them? If not, is there any replacing implementation to my code?
I'm using selenium java 2.28.0.
For Firefox 18 support we need use selenium webdriver api 2.28.0,jar.
Selenium Java 2.27 mentions that native support for FF17 has been added. However, there has been no mention of support for FF18 in the change logs for 2.28. So its webdriver not supporting native events and not FF18 not supporting native events. You can try downgrading to FF 17 and probably turn off automatic updates for some time.
Rolling back to FF17 is a temporary work around until WebDriver version supports FF18
FF17 Extended Support Release packages -- http://www.mozilla.org/en-US/firefox/organizations/all.html
Note: If you are Mac user, you can simply rename your current FF from 'FireFox' to 'FireFox18' in your applications folder. Install the package from the above URL, which should create a new application called 'FireFox' that will be used by WebDriver.
My hover-over broke with v28. I now use the following hoverOver method with an optional javascript workaround and it seems to work okay.
public void HoverOver(IWebElement elem, bool javascriptWorkaround = true)
{
if (javascriptWorkaround)
{
String code = "var fireOnThis = arguments[0];"
+ "var evObj = document.createEvent('MouseEvents');"
+ "evObj.initEvent( 'mouseover', true, true );"
+ "fireOnThis.dispatchEvent(evObj);";
((IJavaScriptExecutor)driver).ExecuteScript(code, elem);
}
else
{
Actions builder = new Actions(driver);
builder.MoveToElement(elem).Build().Perform();
}
}
I was facing the same issue with Firefox 20. Then I re-installed latest Selenium server (.jar files).
http://selenium.googlecode.com/files/selenium-server-standalone-2.32.0.jar
Hope this works!

Not Able to Take Screenshot on Safari using Grid and RemoteWebDriver

I am trying to get a screenshot from Safari using Grid and RemoteWebDriver. I have tried the following approaches:
Using the code below. It works on all browsers except Safari. I also tried returning a BASE64 string but didn't work.
WebDriver augmentedDriver = new Augmenter().augment(driver);
File source = ((TakesScreenshot)augmentedDriver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(source, new File("screenshot.png"));
Exception: org.openqa.selenium.WebDriverException
Using WebDriverBackedSelenium. This throws exception.
a.
Selenium sel = new WebDriverBackedSelenium(driver, driver.getCurrentUrl());
sel.captureScreenshot(filename);
Exception: java.lang.UnsupportedOperationException: captureScreenshot
b.
Selenium sel = new WebDriverBackedSelenium(driver, driver.getCurrentUrl());
sel.captureScreenshotToString();
Exception: java.lang.UnsupportedOperationException: WebDriver does not implement TakeScreenshot
I tried sending the key sequence that takes screen shots in MAC (command+shift+3) using sendKeys(Keys.chord(Keys.COMMAND, Keys.SHIFT, "3")) but Keys.COMMAND is not considered as modifier key so this also didn't work.
After some research I came across the issue below:
http://code.google.com/p/selenium/issues/detail?id=4203
I also saw this revision which is suppose to fix the issue but I am not able to figure out how to implement this
http://code.google.com/p/selenium/source/detail?r=17731
I would really appreciate if I could get some help on this. I am using MAC, Safari 5.1.7 and selenium 2.25.
For future reference: this seems to have been fixed in Selenium 2.26

How to mount other rack apps, such as Grape API's to Padrino application?

I am looking around on how to mount other rack apps such as a grape API to my padrino application. I tried searching around but couldn't possibly find an answer.
I tried with the following way:
Padrino.mount("API", :app_file => "path_to_api_rb", :app_class => "MyApp::API").to("/")
But Padrino didn't start with this setting. It seems that facility is only for Padrino-sub apps. Has anyone tried this before?
here's a project showing how to use Grape as a subapp:
PadrinoEatsGrape
(Other Rack apps could work, i guess)
u can use the Rack::Cascade: to mix the grape, rails and pandrino apps:
rails_app = Rack::Builder.new do
use Rails::Rack::LogTailer #Optional
use rails::Rack::Static #Optional
run ActionController::Dispatcher.new
end
run Rack::Cascade.new([
MyApp::API,
rails_app,
Padrino.application
])

Resources