similar to: using javascript to get an attribute using an ID

Displaying 20 results from an estimated 1000 matches similar to: "using javascript to get an attribute using an ID"

2008 May 21
0
Problem with alias_method in a plugin
Hi, I''m doing my first plugin, based on attachment_fu structure. Here''s the code: http://pastie.caboo.se/200797. The problem is that the meta_tag method doesn''t seem to be overwritten. I can call model_instance.original_meta_tag and it return same thing as model_instance.meta_tag, so the aliasing works. I can call model_instance.foo and it correctly returns class of
2013 Oct 25
6
Migrate postgresql database to uuid
Hi all, I am using rails 3.1 and ruby 1.9.3,Now i want to use uuid concept in rails 3 for existing data so i did like :- create_table :posts, :id => false do |t| t.string :uuid, :limit => 36, :primary => true end ActiveRecord::Base.class_eval do # old rails versions set_primary_key ''uuid'' before_create :generate_uuid def generate_uuid self.id =
2007 Jan 10
2
Corrupt index and segfaults with heavy writes?
Hi everyone, We''re running a fairly heavily used Rails app that uses ferret (and acts_as_ferret) for search. We''re running on mongrel+Apache, Ruby 1.8.4, and ferret 0.10.13. We''re indexing a handful of attributes on our "Image" and "User" models. After the system has been running for several days, the index gradually becomes corrupted, and ferret
2007 Apr 11
10
DRYer controller specs
So, I''ve been following the recommendations for controller specs here: http://blog.davidchelimsky.net/articles/2006/11/09/tutorial-rspec-stubs-and-mocks Most notably: a single expectation per specify block; the setup block contains only stubs; mock expectations each get their own specify block. (I''m still using 0.8, so I haven''t gotten the describe/it goodness yet.) I
2006 Feb 21
7
non simultaneous effects
Hi all, If I call this function bla: function bla() { Effect.Appear('some_element'); Effect.Appear('some_other_element'); } Both effect happen at the same time. Is there a way to stop this from happening? I mean, how can I delay the effect on 'some_other_element' from happening until the effect on 'some_element' is finished? thanks and regards, Jeroen
2007 May 04
11
spec template for CRUD?
Hello, Has anyone already come up with a set of shared behaviours that someone could leverage when adhering to a CRUD concept, with respect to controllers? Relatedly, it would be nice if there were a way to share generalized behaviour specs. -Chris
2006 Apr 15
2
Can''t run MySQL queries
Hi everyone, I''m having trouble actually running mysql queries. I can connect to the database, I think, but when a query gets run the following shows up in my log: SQL (0.000000) Mysql::Error: Lost connection to MySQL server during query: SHOW TABLES Any suggestions? Thanks! Daniel Higginbotham
2006 May 25
16
yet another rails site - happycarpools.com
I''m pretty much done with a project I''ve been developing to learn Rails, http://www.happycarpools.com . If you could take a look, that''d be awesome! Feedback would be even more awesome! Probably the coolest thing about making this has been seeing how Rails does *so much* and hardly has any superfluous parts, if any. There are so many features that I initially
2004 Sep 21
5
R 1.9.1 Fails to Start on WinXP SP2
I have two computers both of which are running Windows XP SP2. R 1.9.1 runs just fine on one but not the other. Both installations of R came from the same installation package. When I click on the desktop icon an hourglass shows up then disappears. Similarly, if I start RGUI the process shows up in task-manager then abruptly disappears. Interestingly, I can access R in Excel via the D(COM) Server
2006 Jun 17
0
Dynamic forms containing collections
Hiall, I have the following problem: I need to use forms containing collections (i will call them FCC), and I want to construct them dynamically, as I need to deal with quite large forms (more than 600 input fields). The variables @model_name and @field_name contain the proper model and field names as strings, which is enough for "normal" form input fields. (i.e. the "if
2012 Apr 25
2
Rails 3.1 - Scaffolding Files
Where can I find more information about the new syntax on these: <%- model_class = @product.class -%> <h1><%=t ''.title'', :default => t(''helpers.titles.new'', :model => model_class.model_name.human, :default => "New #{model_class.model_name.human}") %></h1> <%= render :partial =>
2007 Mar 07
4
Strange Problem With Unwanted, Transient Caching
Hello, I hope somebody can explain to me what''s going on here because I''m baffled! In a controller''s action I want to create a new order for a customer. Because I post back to the same action (not RESTful I know, but that''s for another day) I use code like this: def edit @order = Order.find_by_id(params[:id]) || Order.new ... end I
2006 Apr 16
12
tired of using defined? all the time
Hi everyone, It seems like every time I want to evaluate a possibly undefined variable I have to use defined? to see that it exists first, so I can''t simply have -- if params[:range_start] > 3 or something like it. I need to have -- if defined? params[:range_start] && params[:range_start] > 3 I can''t even have -- if params[:range_start].nil? This is really
2006 May 21
5
model methods
Hello everyone, In my model, I have def leave_at_formatted leave_at.strftime("%I:%M %p") end I was wondering if there were any way to define to_s for leave_at in order to get the same result? Thanks!
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture- driven way of spec-ing or mocking. How the heck to you mock this so the code at line (2) and (4) work right? I''m still struggling with mocks but it seems like this can be done. Forgive the naivety of this question. 1. def change_quantity 2. @line_item = LineItem.find_by_id(params[:id]) 3. unless
2006 Jun 19
4
DateTimes get converted to Dates in XML-RPC????
Hi all - I have written an XML-RPC app using action-web-service. Mostly works well. Except I just noticed that my :datetime types are coming back as :date types. That is, when in the console I query the record via Foo.find_by_id(123) I get back actual datetimes. If I then do it via XML-RPC, fetching that same record I get back dates (ie. hour/minute/second are set to 00:00:00) Any ideas?
2007 Nov 21
7
describe AddressesController, "handling GET /addresses" do
Hello, I''m working with scaffold generated controller test code for handling GET requests. Address is the model being tested. Address belongs_to Company, Company has_many addresses. In my addresses_controller I have: before_filter :get_company def index @addresses = @company.addresses.find(:all) respond_to do |format| format.html # index.html.erb format.xml {
2006 Jun 20
3
return unique rows with finders
I''m looking through the api for something like find(:all, :distinct => true) so that multiple instances of a row won''t be returned - is this possible? Thanks!
2006 Jul 30
1
Bug? find_by_id(nil) returns object just created
Tried to submit a ticket in Trac, but it reported an error... Doing a Model.find_by_id(nil) after creating an object of type Model returns that object -- and the next time, returns nil. It should always return nil. For example, Step 1. Create an object: >> Foo.create(:name => "bar") => #<Foo:0x2aaaac3ade20 @new_record=false,
2012 Aug 01
2
'redirect_to' taking infinite loop.
Hi, The following controller method taking me into infinite loop. Once the update action completes I want to reload the ''index'' page. May I know why it is going into infinite loop? def update Device.find_by_id( params[:device_id] ).driver = ( params[:driver_id] == 0 ) ? nil : Driver.find_by_id( params[:driver_id] ) redirect_to :action => :index, :tab =>