Displaying 17 results from an estimated 17 matches for "bzgi".
Did you mean:
bgi
2007 Jun 07
6
Can't download files with send_data or send_file
I have a form_remote_tag that calls a method to print out a csv file
for download. If I tell the form_remote_tag to update a div the data
comes up in that div, but otherwise I can''t get the browser to
acknowledge the sent file.
>From view:
<%= form_remote_tag :url => {:action => "csv_dump" }%>
<%= submit_tag "Download Complete List" ,:name
2007 Dec 27
4
validates_file_format_of only when is there an image
i have a model with this:
file_column :image
validates_file_format_of :image, :in => ["gif", "png", "jpg"]
If inthe form the user not insert the image i receive an error.
If i remove:
validates_file_format_of :image, :in => ["gif", "png", "jpg"]
it works.
Is possible do the validation only when user insert the image in form?
i
2005 Aug 08
5
In-Line List Editing with AJAX
I''m trying to write an interface for editing many-to-one relationships
with AJAX. Picture the to-do editor in Backpack (and, to a lesser
extent, Basecamp) and you''ll have a good idea of what I''m trying
to do.
I''ve almost got everything working: the ''edit'' link hides the stored
data and replaces it with a form, and the data is updated in the
2005 Oct 19
35
Why you MUST use SCGI for Rails development
Hello happy Railers,
I used to develop with a local out-of-the-box Apache and load times were
pretty slow (like a few seconds each page). "Well, it''s the price to
pay for no compile / cache / etc..." I thought. Nonsense. Yesterday I
installed SCGI, and now I''ve got the best of both worlds: rails
development env uses my very latest modifications, while SCGI ensures I
2009 Feb 19
3
Associated child records not created on creation of a parent.
I am trying to create a record with association. Within the create
method, I would also like to pre-populate dependent (has_many) records
from a template in the database.
The child records are <u>mysteriously rolled back </u> if I insert
them in a loop. If I try to insert a single child record, it works.I
have read the books and tried to google my way out of this but am at a
dead
2006 Dec 01
4
uninitialized constant error in app but not when using console
I''ve got a wierd issue here and maybe someone can assist
i created a module in my apps lib directory which i use for
authenticating against an external source (among other things).
lib/myapp.rb
-----------------
require ''rubygems''
require_gem ''activerecord''
# uses activerecord odbc adapter by openlink
module MyApp
module ExternalSource
class
2005 Dec 23
10
Extending model
Hi,
I''m looking for a way to extend one of my models to allow some level
of abstraction between what goes into it and how it is stored.
For example, say I have a Product and I want to set it''s price. A
person using the website will type the price in euros. Internally, I''d
like to store the price as an integer value of cents.
I can currently do this with some ugly code
2005 Dec 30
2
before_create question
I have the following models: User, Registration, Event.
User has_many Registration, Event has_many Registration, and
Registration belongs_to User and Registration. So far, so good.
There''s a registration deadline on a Event though, a few days before
the Event occurs.
So, I have this:
class Registration < AR
def before_create
errors.add_to_base("Registration deadline has
2005 Oct 26
1
Re: collection_select question about selected_value
Paul Welty wrote:
> collection_select(:client, :company_id, @companies, :id, :name, {
> :selected_value => 2 , :prompt => "Please select a company..." })
>
> Returns a functioning SELECT element, but it won¹t select the second item.
> (BTW, using the selected_value as a string doesn¹t work either)
>
> Am I doing something wrong, or is this impossible?
>
2008 Aug 25
2
Validating an association
I have two models, A and B, related to one another by a many to many
association and I want to validate an object of model B as it''s being
added to the association based on both its own attributes and
attributes of the particular object of model A that it''s being
associated with.
I''ve realized that I can''t do this if the association is represented
by a habtm
2006 Nov 20
2
getting form content for print popup
I''m trying to open a new window for printing a form from a link. I want
to display the contents of the form for printing. I can get the popup
to work, but am wondering how to get the contents of the form from the
parent window, using RJS.
I can use a submit option to get the form parameters in a
link_to_remote, but the popup doesn''t work.
<%= link_to_remote
2008 Dec 13
3
session In the model
Hi
i have the model SDTicket which has a field modified_by_id and it has
to take data from session[:id] Now this SDTicket model has many
associated models like Activity one of them So when ever an activity
happens then also the value in session[:id] is to be go to
modified_by_id field
SDTicket has_many activities
Activity belongs to SDTicket
So for that what I am trying is in Activity
2007 Dec 05
4
render :update and controller private methods
Probably asked and answered, but...
Why are controller private methods inaccessible inside the block
passed to render :update ?
This does not work:
class MyController < ApplicationController
def some_action
render :update do |page|
page.replace_html ''an_element'', some_private_method
end
end
private
def some_private_method
return
2008 Dec 13
3
how to do "special queries" ala The Rails Way on "associated" conditions?
I have the following in a model class:
class Game < ActiveRecord::Base
has_many :player_stats
has_many :players, :through => :player_stats
def visitor_stats
stats = []
player_stats.each do |stat|
stats << stat if stat.player.team.team_code ==
self.visiting_team_code
end
stats
end
def home_stats
stats = []
player_stats.each do |stat|
stats << stat if
2007 Nov 26
6
Model setters, override attribute=(attribute)?
Hi,
I have a model similar Basket shown below. If customer_type is set
then it should also set customer to nil. Likewise, if I set customer,
it should inspect the customer_type attached to the customer and set
accordingly within Basket. However implementing it as below doesn''t
seem to work.
Am I missing a better way to achieve this? I had also considered using
a before_save
2008 Nov 12
5
dynamic condition for has_one and eager loading issue
Hi,
I ve defined the following relation in one of my models with a dynamic
where condition:
has_one :selection,
:foreign_key => ''object_id'',
:conditions => ''selection_type = 1 and account_id = #
{self.send(:account_id)}''
That works perfect, however when I try to eager load that relation I
am getting the following error when doing a
2008 Jun 02
4
Cannot find sqlserver adaptor for ActiveRecord
I have been trying to find the adtiverecord adaptor for MS SQL server
and attempted to install with the command found on the
http://wiki.rubyonrails.com/rails/pages/HowtoConnectToMicrosoftSQLServer
wiki page:
gem install activerecord-sqlserver-adapter --source=http://
gems.rubyonrails.org
I then got the error message:
ERROR: could not find activerecord-sqlserver-adapter locally or in
a