Search Results

Search found 5349 results on 214 pages for 'override'.

Page 13/214 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • How to override the attr_protected?

    - by KandadaBoggu
    I have STI implementation as follows: class Automobile < ActiveRecord::Base end class Car < Automobile end class Truck < Automobile end class User < ActiveRecord::Base has_many :automobiles accepts_nested_attributes_for :automobiles end I am creating a list of automobiles for a user. For each automobile, the UI sets the type field and the properties associated with the automobile.While form submission, the type field is ignored as it is a protected attribute. How do I work around this issue? Is there a declarative way to unprotect a protected attribute?

    Read the article

  • magento override sort order of product list by subcategories

    - by dardub
    I'm setting up a new store using 1.4.1 I'm trying sort the products in the list by the subcategories they belong to. At the top of list.phtml is $_productCollection=$this->getLoadedProductCollection(); I tried adding sort filters to that by adding the line $_productCollection->setOrder('category_ids', 'asc')->setOrder('name', 'asc'); I also tried addAttributeToSort instead of setOrder. This doesn't seem to have any effect. I'm guessing that $_productCollection is not a model I can sort in this manner. I have been digging around trying to find the correct place to apply the sort method without any success. Can someone tell me the proper place to do this?

    Read the article

  • Override as_json or to_json model class name

    - by Jack
    I'd like to modify the classname when calling to_json on an AR model. i.e. Book.first.to_json #=> "{\"book\":{\"created_at\":\"2010-03-23 Book.first.to_json(:root => 'libro') #=> "{\"libro\":{\"created_at\":\"2010-03-23 Is there an option to do this?

    Read the article

  • How do you get SQLAlchemy to override MySQL "on update CURRENT_TIMESTAMP"

    - by nocola
    I've inherited an older database that was setup with a "on update CURRENT_TIMESTAMP" put on a field that should only describe an item's creation. With PHP I have been using "timestamp=timestamp" on UPDATE clauses, but in SQLAlchemy I can't seem to force the system to use the set timestamp. Do I have no choice and need to update the MySQL table (millions of rows)? foo = session.query(f).get(int(1)) ts = foo.timestamp setattr(foo, 'timestamp', ts) setattr(foo, 'bar', bar) www_model.www_Session.commit() I have also tried: foo = session.query(f).get(int(1)) setattr(foo, 'timestamp', foo.timestamp) setattr(foo, 'bar', bar) www_model.www_Session.commit()

    Read the article

  • Override l() function in Drupal

    - by Marco
    I'm currently working on a Drupal site (6.*), which when in production mode will be accessed through some kind of http proxy, which means I will have to rewrite all the links for my custom theme if the $_SERVER['HTTP_X_FORWARDED_SERVER'] variable is set to the domain people will access the site from. The site has a lot of internal linking, mostly through Views. My thought is that the easiest way to solve this would be to hook into the url() and/or the l() functions and post process the url before returning it if HTTP_X_FORWARDED_SERVER is set. My problem is that I can't figure out how to hook into these functions, or if it's even possible without touching the core, has anyone had to do this? How did you solve it?

    Read the article

  • Magento: custom module layout override not working

    - by Socrates
    I have a small custom module which is supposed to show on all product pages, but it doesn't. It only shows when setting its reference to "content", but I want it to display witin the already existing product view divs, thus, display it within the "product.info" reference. Here's my code: app/design/frontend/default/company/layout/company/socialbuttons.xml <?xml version="1.0"?> <layout> <catalog_product_view> <reference name="product.info"> <block type="core/template" name="company_socialbuttons" template="company/socialbuttons.phtml" /> </reference> </catalog_product_view> </layout> I've spent hours finding the error, without success and if I can't find a solution soon I will do it the ugly way (calling the phtml inside the parent phtml). What am I doing wrong?

    Read the article

  • Override tablesorter CSS

    - by user1712810
    I am using jquery tablesorter. When the page loads, I have a code to highlight the background color of certain rows in the table. Since tablesorter is used I guess it overrides the css and not allowing to change the background color of the rows. This is the code. This function automatically loads when the page gets loaded. I removed table-sorter to the table and tried this. It works. I have to get it to work with the table-sorter applied. $(document).ready(function() { var row, len, results; row = 0; results = []; while (row < len) { if ($("#tab1 #example_"+row+"chkbx").is(":checked")) { $("#tab1 #example_" + row).css("background-color", "#c6b79f"); } row++; } return results; });

    Read the article

  • python: equivalent to Javascript "||" to override non-truthful value

    - by Jason S
    In Javascript I can do this: function A(x) { return x || 3; } This returns 3 if x is a "non-truthful" value like 0, null, false, and it returns x otherwise. This is useful for empty arguments, e.g. I can do A() and it will evaluate as 3. Does Python have an equivalent? I guess I could make one out of the ternary operator a if b else c but was wondering what people use for this.

    Read the article

  • Can you override just part of a control template in silverlight

    - by mattmanser
    Is it possible to change or modify a specific part of a control template without having to recreate the entire control template of the control in the xaml? For example, I was trying to get rid of the border of a textbox, so I could throw together a basic search box with rounded corners (example xaml below). Setting the borderthickness to 0 works fine, until you mouse over the textbox and a pseudo border they added to the control flashes up. If I look at the controltemplate for the textbox, I can even see the visual state is named, but cannot think of how to disable it. Without overriding the control template of the TextBox, how would I stop the Visual State Manager firing the mouse over effect on the TextBox? <Border Background="White" CornerRadius="10" VerticalAlignment="Center" HorizontalAlignment="Center" BorderThickness="3" BorderBrush="#88000000"> <Grid VerticalAlignment="Center" HorizontalAlignment="Center" Width="200" Margin="5,0,0,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="16" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Path Height="13" Width="14" Stretch="Fill" Stroke="#FF000000" StrokeThickness="2" Data="M9.5,5 C9.5,7.4852815 7.4852815,9.5 5,9.5 C2.5147185,9.5 0.5,7.4852815 0.5,5 C0.5,2.5147185 2.5147185,0.5 5,0.5 C7.4852815,0.5 9.5,2.5147185 9.5,5 z M8.5,8.4999971 L13.5,12.499997" /> <TextBox GotFocus="TextBox_GotFocus" Background="Transparent" Grid.Column="1" BorderThickness="0" Text="I am searchtext" Margin="5,0,5,0" HorizontalAlignment="Stretch" /> </Grid> </Border>

    Read the article

  • css override not working?

    - by Karin
    I have three tabs that change styles when clicked. class="active" gives the tab the same background as the tab content, while class="inactive" has another color. My problem is the text on the tabs, something's weird with the CSS. The default state of class="active" looks as it should, while the inactive tabs are underlined even though my CSS says text-decoration: none !important; and the clicked active tab text becomes extra bold (or maybe it's a shadow). Please look at my fiddle: http://jsfiddle.net/m8wQM/170/

    Read the article

  • Cannot override the CSS at this site

    - by gdanko
    This site is overriding my CSS with its own and I cannot get around it! It has style.css with "text-align: center" in the body. I have <div id="mydiv"> appended to the body and it's normally got "text-align: left". There are <ul>s and <li>s underneath #mydiv and they are inheriting the body's 'center' for some reason. I tried this and it's still not working. $('#mydiv').children().css('text-align', 'auto'); How the heck do I reclaim my CSS!? @Grillz, the HTML looks like this: <div id="mydiv"> <ul class="container"> <li rel="folder" class="category"><a href="#">category1</a> <ul><li rel="file" class="subcategory"><a href="#">subcategory1</a></li></ul> <ul><li rel="file" class="subcategory"><a href="#">subcategory2</a></li></ul> </li> <li rel="folder" class="category"><a href="#">category2</a> <ul><li rel="file" class="subcategory"><a href="#">subcategory3</a></li></ul> <ul><li rel="file" class="subcategory"><a href="#">subcategory4</a></li></ul> </li> </ul>

    Read the article

  • Override default javascript functionality with jQuery

    - by deth4uall
    I am trying to overwrite a JavaScript on change event in the below code with jQuery however I believe that the inline JavaScript is taking priority over the jQuery functionality declared. Essentially I am trying to have an AJAX version of my site which includes an additional JavaScript file. I need this functionality to still work without the additional AJAX version, but I am not sure as to whether I should include it in the main JavaScript file or leave it inline like it is right now. Any suggestions and information regarding them would be greatly appreciated! Thanks! <form action="/cityhall/villages/" method="post" name="submit_village"> <select name="village" onchange="document.submit_village.submit();"> <option value=""></option> </select> </form> I am trying to use the jQuery Form Plugin to submit the posts to the PHP to handle the requests as follows: var bank_load_options = { target: '#content', beforeSubmit: showRequest, success: showResponse }; $('form.get_pages').livequery(function(){ $(this).ajaxForm(bank_load_options); return false; }); I modified the code as following: <form action="/cityhall/villages/" method="post" id="submit_village" name="submit_village"> <select name="village" class="get_pages" rel="submit_village"> <option value=""></option> </select> </form> <script> # main JavaScript $('.get_pages').live('change',function(e){ var submit_page = $(this).attr('rel'); $("#"+submit_page).submit(); }); # ajax JavaScript var bank_load_options = { target: '#content', beforeSubmit: showRequest, success: showResponse }; $('.get_pages').live('change',function(){ var submit_page = $(this).attr('rel'); $("#"+submit_page).ajaxForm(get_pages_load_options); return false; }); </script> However now it only runs every other option when I change it.

    Read the article

  • Need to override cascade style

    - by WillingLearner
    i have a style : .window .div { border:medium solid #000000; height:150px; background-color: #0099FF; } and then i have another style: #NewDiv { font:Arial, Helvetica, sans-serif; font-size: 24px; height: 20px; border-bottom-width: medium; border-bottom-style: solid; border-bottom-color: #000000; } I need to put a #NewDiv div tag inside of window .div, BUT... #NewDiv must retain its own styling while sitting inside of window .div div tags. How do I do this? Currently when I try, #NewDiv takes on the same styling as window .div when i place it inside of it and i dont want that at all. Any suggestions?

    Read the article

  • How to override jquery's show() and hide() functions

    - by Max Williams
    hi all Short version of question: see title Long version of question: I've used jquery's show() and hide() functions extensively in my code and just encountered a bit of a problem: they work by changing the display attribute of the element to 'block' or 'none' respectively, so that if you have somethin that has display: inline and then hide and show it, you've changed its display to block, which screws up the layout in a couple of cases. In my code, whenever i want something to be hidden initially i give it a class 'hidden'. This class is simply {display: none}. I'd like the change show and hide to remove or add this class, instead of directly changing the display attribute, so that if you add the hidden class and then remove it again (ie hide and show something) then it's back to exactly how it was to start off with (since adding a class overrides the attributes rather than directly changing them). Something like this (this is a little pseucodey as i don't know how to set the function up properly - let's assume that 'this' is the object that show/hide was called on) function show(){ this.removeClass("hidden"); } function hide(){ this.addClass("hidden"); } how and where would i go about overriding the jquery methods? (I'm not a javascript expert) thanks - max

    Read the article

  • override __set in __construct() in php?

    - by user151841
    I have a class based on database values. I'm using __set to automatically sync database values with the class properties. Set checks an array of database fields that it is allowed to update in the database. The field 'id' isn't in the list, so __set will throw an exception if you try to do $objDbRow->id = 5;. However, there is one time when I do want to set the id property of the object, and that's on instantiation. So in __constuct, I have $this->id = $id (where $id is passed to __construct). However, __set seems to be intercepting the setting here, because an exception is being thrown on construction. What's the way to get around this? I suppose I also have a boolean flag, like $instantiated, that __set() would check before it does it's field whitelist checking. But that feels inelegant.

    Read the article

  • Ant loadfile override property

    - by lucks
    Hi, I'm trying to use the Ant task <loadfile> in a loop to parse the contents of a file. I have something like <loadfile srcFile="@{some.input}" property="my.property"> Since Ant properties are immutable, this doesn't work for me. I need 'my.property' to update on every iteration. Is there a way to achieve this? I know Ant-contrib has a <var> task but I'm not sure how to use <loadfile> with it. Any recommendations? Thanks.

    Read the article

  • How to override the focus on page in greasmonkey

    - by nimo
    After the page has loaded a piece of javascript set focus on window and on a specific input field. I want to prevent this focus on the input field how can I do that with javascript in greasemonkey? Maybe this is not possible because greasemonkey don't execute the code until the entire page has loaded? Then let's say I can run my code at any time how can I prevent the focusing?

    Read the article

  • Add color to selected <li> item / override <ul> style

    - by Alana
    I have navigation for which I need to set a color for the selected item. It's flat HTML and CSS. Here's the menu code: <ul id="top_navigation"> <li class="border_red"><a href="index.html">Home</a></li> <li class="border_red"><a href="about.html">About</a></li> <li class="border_red"><a href="services.html"><font color="#cf3533">Services</font></a></li> <li class="border_red"><a href="careers.html">Careers</a></li> <li class="border_red"><a href="news.html">News</a></li> <li class="border_red"><a href="sitemap.html">Sitemap</a></li> <li><a href="contact.html">Contact</a></li> </ul> And here's the CSS - there's the basic set up and then a class to put the pipe between the items: #top_navigation { width: 696px; margin: 0px; padding: 0 0 0 4px; list-style-type: none; overflow: hidden; } #top_navigation li { width: auto; height: 17px; margin: 0px; padding: 1px 10px 0 10px; float: left; } #top_navigation li a { margin: 0px; padding: 0px; display: block; font-size: 12px; text-align: center; text-decoration: none; } #top_navigation li a:hover { color: #cf3533; } This sets the pipe on the right. .border_red { border-right: 1px solid #d7d7d7; } I tried combining the two and creating a _selected style, and the pipe shows up, but I can't get the color to change for the selected. I have to be WCAG Priorities 1,2,3-compliant, so I can't just set it manually with .

    Read the article

  • How to override a Magento administration panel?

    - by Michelangelo
    Hi guys, I would like to know how have I do to add a field in the customer administration at system-configuration-Customer settings panel. Have I create the system.xml file from the core and paste in the local folder with the same path? and have I maintain all the content of the file or I can write only the portion interested? thanks

    Read the article

  • PHP cache header override

    - by Soyo
    I've been through over 100 answers here, lots to try, NOTHING working?? Have a PHP based site. I need caching OFF for all .php files EXCEPT A SELECT FEW. So, in .htaccess, I have the following: ExpiresActive On # Eliminate caching for certain dynamic files <FilesMatch "\.(php|cgi|pl)$"> ExpiresDefault A0 Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform" Header set Pragma "no-cache" </FilesMatch> Using Firebug, I see the following: Cache-Control no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform Connection Keep-Alive Content-Type text/html Date Sun, 02 Sep 2012 19:22:27 GMT Expires Sun, 02 Sep 2012 19:22:27 GMT Keep-Alive timeout=3, max=100 Pragma no-cache Server Apache Transfer-Encoding chunked X-Powered-By PHP/5.2.17 Hey, Looks great! BUT, I have a couple .php pages I need some very short caching on. I thought the simple answer was having this added to the very top of each php page in which I want caching enabled: <?php header("Cache-Control: max-age=360"); ?> Nope. Then I tried various versions of the above. Nope. Then I tried meta http-equiv variations. Nope. Then I tried variations of the .htaccess code along with the above variations, such as limiting it to: # Eliminate caching for certain dynamic files <FilesMatch "\.(php|cgi|pl)$"> Header set Cache-Control "no-cache, max-age=0" </FilesMatch> Nope. It seems nothing I do will allow a single .php to be cache enabled with the .htaccess code in place, short of removing the statements from the .htaccess file altogether. Where am I going wrong? What do I have to do to get individual php pages to be cacheable while the rest remain off?? Thank you for any thoughts.

    Read the article

  • Obj-c method override/polymorphism problem

    - by Rod
    Ok, so I'm using Objective-C. Now, say I have: TopClass : NSObject - (int) getVal {return 1;} MidClass : TopClass - (int) getVal {return 2;} BotClass : MidClass - (int) getVal {return 3;} I then put objects of each type into an NSMutableArray and take one out. What I want to do is run the getVal func on the appropriate object type, but when I put id a = [allObjects objectAtIndex:0]; if ([a isKindOfClass:[TopClass class]]) { int i; i = [a getVal]; } I get firstly a warning about multiple methods called getVal (presumably because the compiler can't determine the actual object type until runtime). But more seriously I also get an error "void value not ignored as it should be" and it won't compile. If I don't try and use the return from [a getVal] then it compiles fine e.g. [a getval]; //obviously no good if I want to use the return value It will also work if I use isMemberOfClass statements to cast the object to a class before running the function e.g. if ([a isMemberOfClass:[BotClass]) i = [(BotClass*) a getVal]; But surely I shouldn't have to do this to get the functionality I require? Otherwise I'll have to put in a statement for every single subclass, and worse have to add a new line if I add a new sub class, which rather defeats the point of method overriding doesn't it? Surely there is a better way?

    Read the article

  • Spring @Transactional - Can I Override rollbackFor

    - by user475039
    Hi all, I am calling a service which has the following annotation: @Transactional(rollbackFor=ExceptionA.class) public void myMethodA(....) throws ExceptionA { . . } I am calling this method from an other method in another Spring Bean. @Transactional(rollbackFor=ExceptionB.class) public void mainEntryPointMethod(....) throws ExceptionB { . try { myMethodA() } catch (ExceptionA exp) { . } . } My problem is that if myMethodA throws an exception, my transaction (which is passed from mainEntryPointMethod - myMethodA by default propagation) will be marked for rollback. Is there a way in which the 'rollbackFor' for the inner method can be overriden? Thanks in advance Chris

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >