Skip to content

Instantly share code, notes, and snippets.

@jblac
jblac / company.rb
Last active December 13, 2015 22:08
user.company fails to load anything...
class Company < ActiveRecord::Base
attr_accessible :address, :city, :contact_email, :contact_name, :fax_number, :name, :phone_number, :state, :zip
has_many :users
end
class User < ActiveRecord::Base
attr_accessible :company_id, :email, :enabled, :first_name, :last_name, :password, :username
belongs_to :company
end
public function getCountAction() {
$user = $this->getUser();
$entities = $em->getRepository('EcsCrmBundle:Notifications')->findBy(array('sentTo'=>$user->getId(), 'dateAckknowledged' => 'NULL'));
$count = sizeof($entities);
}
function getNotificationsCount() {
$.ajax({
url: '/notifications/count',
type:'GET',
success: function(response) {
if (response < 1) {
$('.nCount').hide();
} else {
$('.nCount').text(response).show();
}
@jblac
jblac / vhost
Created February 24, 2013 23:55
<VirtualHost *:80>
ServerName mysite.dev
ServerAlias www.mysite.dev
DocumentRoot /var/www/mysite.com/htdocs
<Directory /var/www/mysite.com/htdocs/>
Allow from all
</Directory>
RailsBaseURI /
RailsBaseURI /adm
<Directory /var/www/mysite.com/htdocs/www/>
/**
* Adds support for magic finders.
*
* @return array|object The found entity/entities.
* @throws BadMethodCallException If the method called is an invalid find* method
* or no find* method at all and therefore an invalid
* method call.
*/
public function __call($method, $arguments)
{
public function assignCaseManagerAction($id) {
$em = $this->getDoctrine()->getManager();
$customer = $this->getCustomer($id);
$request = $this->getRequest();
if (!$customer) {
throw $this->createNotFoundException('Unable to find Customer entity.');
}
jms_security_extra:
secure_all_services: false
expressions: true
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
jms_security_extra:
secure_all_services: false
expressions: true
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: Fm\AdminBundle\Entity\Users
jms_security_extra:
secure_all_services: false
expressions: true
security:
encoders:
Symfony\Component\Security\Core\User\User: sha512
Fm\AdminBundle\Entity\Admins: sha512