Displaying 20 results from an estimated 400 matches similar to: "paperclip model fails while when updating with no attachment"
2009 Sep 03
12
paperclip is not saving the files
Hi all,
I''ve installed paperclips but
paperclip is not saving the files
my model has
has_attached_file :attachment,:styles => { :medium => "300x300>",
:thumb => "100x100>" }
and i have db migration as
class AddAttachmentToPolicies < ActiveRecord::Migration
def self.up
add_column :policies,
2011 Oct 05
2
formtastic / activeadmin
Newbie question:
want to following code to migrate to formtastic:
<% f.fields_for :assets do |asset_fields| %>
<% if asset_fields.object.new_record? %>
<p>
<%= asset_fields.file_field :asset %>
</p>
<% end %>
<% end %>
tried this:
f.inputs "Appartment Details" do
f.input :assets do |asset_fields|
2008 Jan 18
2
NameError when using alias_method -- but method exists?
Hello Rubyists,
I am a bit stumped here. I want to extend the ''load_file'' method in the
YAML module. Following along with the PickAxe example of making old
methods do new things, I try this in irb:
>> module YAML
>> alias_method :orig_load_f, :load_file
>> def load_file(*args)
>> contents = orig_load_f(*args)
>>
2006 May 05
3
posting xml in functional test
Hello,
I''m trying to write a functional test for a simple CRUD controller which
accepts / emits xml in a REST- like fashion. However the following code
won''t work for me - an exception is generated
def test_create
post :create, ''<person><name>john</name></person>'',
2006 Apr 16
3
variable variables?
Hi everyone,
Does Ruby support variable variables like PHP
(http://www.php.net/manual/en/language.variables.variable.php)? Or do I have
to use eval, like
some_hash.each_pair{|key, pair|
eval "#{key} = #{value}"
}
Or is there some other way?
I''m actually trying to figure this out in order to use ez_where to create
its conditions from a hash, so if this isn''t even
2008 Jan 31
3
presenting validation errors via fbml?
Hi Facebookers,
Is there a helper or suggested approach for presenting validation
errors on an fbml form?
Something to translate rails error markup to fbml:error markup?
thanks
Joel
2006 Aug 13
1
establish_connection method
I''m digging into rails source code.
But I''ve got a problem in undestading actionrecord::base source code
which is connection_specification.rb.
In the body of establish_connection method,
def self.establish_connection(spec = nil)
case spec
when nil
raise AdapterNotSpecified unless defined? RAILS_ENV
establish_connection(RAILS_ENV)
2006 Jun 13
7
help with ''error_messages_for''
Greetings,
I''m in the throws of deploying an app on site5, and I''m getting strange
errors. I think I might need to understand how error_messages_for
works.
I get a pretty standard looking error:
"
You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occured while evaluating nil.errors
Extracted
2005 May 04
1
Conditional validations
I''ve been working with the problem that Joe Hosteny has been talking
about on this list and on the tickets he''s posted
(http://dev.rubyonrails.com/ticket/1196) and have come up with a
tentative solution that I''d like to bring up here.
What if we use a "conditional" parameter in the validates_* methods?
Here''s how it would look like in practice:
2007 Oct 04
1
PUT- or POST-ing xml
I''d like to write a test of a REST service wherein XML is submitted as the
request entity.
In Test::Unit on Rails, this seems to be possible in an integration test,
but not in a functional test. RSpec uses the Rails functional test
framework, as far as I can tell, so it suffers the same result; it tries to
symbolize the keys of the ''parameters'' hash, except the
2008 Apr 25
2
json => hash in Ruby
Hi everyone,
I would like to decode a json string and transform it into a hash in
ruby.
I tried
json = "{\"userid\" : \"21\", \"friendid\" : \"9\"}"
hash = ActiveSupport::JSON.decode(json)
puts hash[:userid]
however, this gives NIL back. How do I have to do this?
Thanks for any help!
--~--~---------~--~----~------------~-------~--~----~
You
2009 Sep 25
0
Paperclip: Adding attachment to model on update not working
Hi,
This is a bit of a special case. Ive got a POST form for a posts model
which has a preview functionality. So if the user clicks on "Preview",
then the model is saved and a new window opens with the preview. And
the user can keep adding content to the post and previewing before
he''s satisfied and clicks on "Publish". And for every subsequent
previews, i pull that
2011 Feb 23
0
Dynamically setting Paperclip processors with attachment instance data
I''m trying to dynamically set my Paperclip processors which are stored
in my database, ideally I would want to access
attachment.instance.paperclip_processor, but I can''t seem to do that.
Any ideas?
# class Post < ActiveRecord::Base
has_attached_file :image,
:path => ":rails_root/
public/:hash_path/:style/:basename.:extension",
:processors => lambda {
2008 Sep 14
3
paperclip attachment destroy
Hi all
I''ve got a problem with the paperclip-plugin.
Is it posible that the attachment is not destroy if i call the
destroy-
method of a model?
Thank you for your help!
sigma
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Sep 12
2
accessing validates_... , :message => 'something'
Hi,
i have a validates_something_of_something method in my User model...i
added a :message => "you need to abcd" to the validation method, but
when i try to access it through the <%= error_messages_for "user" %> it
doesn''t give me any output...
i was wondering whether there was a way to access all of the (:message
=> string) methods that are collected
2009 Sep 09
1
Paperclip attachment to AWS - ActiveRecord::AssociationTypeMismatch Going Nuts!
Hi,
I have been trying to do this for a few days now and cannot figure it out. I
would be very grateful is anyone can help me
I am trying to upload an attachment to AWS, S3 using paperclip,
however every time I keep getting this error:
ActiveRecord::AssociationTypeMismatch in ProjectController#create_notice
Graphic(#37649720) expected, got Tempfile(#27280470)
RAILS_ROOT:
2006 Dec 12
2
Error message translation
I have a problem with translation of english phrase when an input error
occurs. When I put: error_messages_for("registratie") above my view. I
get the error: "xx errors prohibited this registratie from being saved".
The problem now is, the site is for dutch customers and I would like to
translate this to a dutch phrase. I know I can translate the individual
fields with the
2009 Sep 10
2
Paperclip attachment to AWS - ActiveRecord::AssociationTypeMismatch
Hi,
I have been trying to do this for a few days now and cannot figure it
out. I would be very grateful is anyone can help me
I am trying to upload an attachment to AWS, S3 using paperclip,
however every time I keep getting this error:
ActiveRecord::AssociationTypeMismatch in
ProjectController#create_notice
Graphic(#37649720) expected, got Tempfile(#27280470)
RAILS_ROOT:
2006 Nov 04
6
image_tag keeping add ???? after the url it generates
hi, all,
I have a problem with image_tag, the url it generates keeps adding ???? at
the tail.
e.g.
src="/images/gicon.jpg?1153577588??????????"
src="/images/gicon.jpg?1153577588?????????????????"
I''ve checked the source code of image_tag, and couldn''t find any solution.
The ????
is appended to the "source" parameter before it goes to the real
2012 Jul 20
8
sti_object.becomes(Parent) unexpectedly mutating the receiver
I ran into an interesting issue today with ActiveRecord''s becomes method
and discovered that it is mutating the receiver without me knowing it.
The API docs<http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-becomes>say
"The new instance will share a link to the same attributes as the original
> class. So any change to the attributes in either