Displaying 20 results from an estimated 10000 matches similar to: "Print link or button?"
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 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 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 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 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 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 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 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 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 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 Jul 04
2
Display a calendar helper
Before I starting writing a helper to display a calendar I wondered if 
anyone was aware of a calendar helper, basically something that is 
displayed inline (not a pop-up window) that can replace a date_select.
The way I am thinking of doing it is to have a partial which is passed a 
Time class, the month is extracted from the date and a grid displayed 
for that month. Which should not be to
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 Apr 16
8
"Cannot convert String to Integer" after using association
So, I''ve written a partial that does some stuff with a given instance of 
my class "entity". Entity is ActiveRecord. I''m able to retrieve all 
sorts of data from an @entity, until I do something like:
<% for @attribute in @entity.attributes %>
    <div id="attribute_<%= @attribute.id %>">
    	<%= render(:partial =>
2006 Jul 03
2
Routing acting strangely - mixed case controller names fail?
All,
I have a link that used to work but now generates a routing error.  The 
link URL is a straightforward controller/action/id and of course, I have
  map.connect '':controller/:action/:id''
in my routes.rb file.
When I click on this link, I get a routing error.  What''s potentially 
interesting about this URL is that the controller name is mixed case. 
Class is
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 Jul 03
4
Display find(:include => [:children]) results in a view
I am trying to determine how to display a list returned from a Rails  
find(:include => [:children]).  I am using the following (which works in  the 
console):
 
@patients = Account.find(session[:account_id]).patients.find(:all, :include  
=> [:patient_details])
 
How can I address the patient_details to display them in the view?   The 
console even shows a @patient_details instance variable
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/.
2006 Aug 15
1
Question on start_form_tag and get post method
Hi all,
I have a simple question about start_form_tag. It default generates
method=post. I was wondering how you could use start_form_tag to generate
method=get. Probably a simple question but one I can''t answer with the API
doc.
Thanks in advance,
Onno