similar to: DRY up link_to_remote and its url_for

Displaying 20 results from an estimated 1100 matches similar to: "DRY up link_to_remote and its url_for"

2006 Mar 17
3
Best debugger for Rails on Linux
A quick survey... what''s the best gui debugging tool for Rails 1.0 on Linux that you''ve used? SW versions? Personally I''ve tried FreeRIDE 0.95 and RDT 0.7.0 in Eclipse 3.1.2. Both are very slow and the latter got quite a few bugs itself. TIA! -- Posted via http://www.ruby-forum.com/.
2006 Jun 24
3
Staying DRY -- can views share partials?
Let''s say I have a "main" controller/view and a "sub" controller/view. If I have defined a partial in "main" for the site header (_site_header.rhtml) can I share it with "sub" or does "sub" have to duplicate it, use a symbolic link to the file, or convert the cool partial into an ugly helper? It would be nice to have a shared placed
2006 Jun 24
4
setting attribute in constructor, .NEW works but not .CREATE
I have table "decks" with three fields: "id", "created_at" and "cards" which is a 264-character string field. I have modified the model with a constructor, as follows: class Deck < ActiveRecord::Base attr_reader :cards def initialize @cards = "12345" end end If I call Deck.new from my controller, I get no errors and an object with the
2006 Jul 06
2
link_to_remote method display a loading image?
Hey guys, what would be the best way to incorporate this into the builtin link_to_remote() method? document.getElementById(''main'').innerHTML = ''<img src="/images/loading_small.gif">''; Id like for the item above to take place while the page is loading. I''m currently doing this with another javascript but would prefer to use rails.
2006 Apr 06
2
using select() to relate tables
I''m sorry to be asking trivial questions, but I''m new to RoR and am hooked :), so I''m very impatient to get things up and running. given two related tables, "pcs" and "venues" (venues have many PC''s and each PC belongs to one venue only) I can use a select() to present venue names in the "new PC" form along with other PC details to
2006 Aug 18
4
Button on view
Hi, I have a page containing 3 views (2 are partials). One of the partials needs to have a button that will clear a table called "messages" in the database. I can put a button like this "<%= button_to "Clear Messages", :action => ''clear_messages'' %>" and have the controller do "Message.delete_all". But the problem is that the
2006 Jul 26
4
How to Firebug XHR/AJAX requests
Saw a lot of recommendations for Firebug (http://www.joehewitt.com/software/firebug/) on this list. I''ve scanned its docs and tried it--many useful features. But I''m so dense that I can''t get it to spy XHR/AJAX requests and their response on FC5 running Firefox 1.5.0.4 and Firebug 0.4. Can someone tell me how to get to
2006 Jun 16
3
ActiveRecord, using sql functions for some attributes
Hi. I need to use functions INET_ATON, INET_NTOA for IP address retrieving. Is it possible to make this transparently (without custom SQL for saving, updating and retrieving)?
2006 Jul 05
3
splitting a story with double-spaced para''s
Quick question - if i want to separate a long string of text, separated by single carriage returns, into an array of paragraphs, I can use the following code: paragraphs = article.content.split("\n") The "\n" means a carriage return, as far as I can tell. If I wanted to take text, that had been written using the more common double carriage returns, into an array of
2006 Apr 06
6
select method
The documentation states as an example: select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] }, { :include_blank => true }) could become: <select name="post[person_id]"> <option></option> <option value="1" selected="selected">David</option> <option
2006 Apr 05
25
How to avoid bunch of <% %> ??
Hello, I would like to know is there is a way to avoid poluting the views with tons of <% %> ? Like this <%= start_form_tag() %> <%= text_field_tag(''category[title]'', category.title, {:size => 20, :maxlength => 128}) %> <% if not category.parent_id.nil? %> <%= select("category", "parent_id", Category.find(:all,
2006 Jul 03
13
Eager loading ActiveRecord objects
I have a complex graph of ActiveRecord entities that I want to load with one big honkin'' join query to avoid ripple loading. It''s for a report. However :include doesn''t get me all the way there because I want to load parents of parents (or children of children). I don''t mind doing the SQL by hand but I''m not quite sure what to do to get the result
2006 Jul 05
1
time.next_week bug?
i ran into an error today when dealing with the method next_week and daylight savings time... >> Time.local( 2006,10,23 ).next_week => Tue Oct 24 00:00:00 EDT 2006 Any one know if this is a know issue or should a ticket be created for this issue? thanks for the help mark -- Mark Van Holstyn mvette13@gmail.com http://lotswholetime.com -------------- next part -------------- An HTML
2006 Apr 14
2
Language setting before routing?
When processing a request, where can you obtain the language setting of a user''s browser? I know we can read @request.env["HTTP_ACCEPT_LANGUAGE"] in an action easily. But I need to access it before being routed to a controller''s action... because the accepted language dictates my app''s language setting programmatically and what action to take.
2006 Apr 11
26
Firefox won''t let me send ''&'' with AJAX!
Hi everyone, I''ve encountered a HUGE problem, which may not be RoR-oriented, but there might be a workaround somehow. See, at this moment, I''m unable to send AJAX requests back and forth when the information contains an ampersand (''&''). In essence, request is never completed. The odd thing is that it only happens with Firefox (IE and Opera works fine).
2006 Jul 03
2
Still struggling with data flow ...
Hello, The following view: <%= start_form_tag %> Enter term to find <p> <%= text_field_tag :name, params[:name] %> </p> <%= link_to "Find", { :action => ''find_term''} %> <%= end_form_tag %> does not appear to pass back the value of :name to the action: def find_term term =
2006 Jul 05
2
splitting a paragraph into words and spaces
I''m using this: <% words = article.content.split(/ /) %> <%= words[0..20] %> to (ostensibly) split a paragraph into component words, with spaces in between, then print to html only the first 20 items, words and spaces. I got this (split(/ /)) from the online pickaxe book at http://rubycentral.com/book/ref_c_string.html#String.split . The problem is, the resulting array
2006 Apr 07
2
ActiveRecord find all based on array -- need ids from array
Does anyone know if it is possible to perform an ActiveRecord find by passing in an array? I would like to be able to do the following: MyModel.find(:all, :conditions => ["user_id in (?)", users]) The problem I run into is that the returned SQL contains the to_s() output of the User object, not the ids of those users. Is it possible to change this behavior? I attempted to
2006 Aug 17
2
RJS - slower than normal RHTML?
I know that isn''t supposed to be the case, and it usually isn''t, but today, I''ve run across a situation where rendering the same partial through RJS is taking about 5 times longer than rendering the partial in the RHTML. I have in my main RHTML <tbody id="account_transactions"> <%= render :partial =>
2006 Aug 07
2
converting pdf to images
i am working on a catalog for our customers to order printing. i have worked a little bit with imagemagick and pdf_writer. currently i am uploading a pdf and an image for the preview of the file. i''m just wondering if there is a way to convert a page of the pdf to a jpeg so that i only have to upload once. -- Posted via http://www.ruby-forum.com/.