>> So you are just wanting uniqueness of www_link.href? Will not
>> validates_uniqueness_of in WwwLink class (backed up by a unique
>> constraint in the database of course) do the job? I think in this
>> case it will be the foo2.www_links.create that will fail.
>> Colin
> The constraint is on "ow
Colin Law wrote in post #971847:
> On 2 January 2011 14:11, Michal Burak wrote:
>>>>
>> link1.save!
>>
>> foo2 = create_foo.save!
>> link2 = foo2.www_links.create(:href => 'wp.pl')
>>
>> # when
>> link2.save!
>>
>
Colin Law wrote in post #971843:
> On 2 January 2011 13:42, Michal Burak wrote:
>> class Foo < ActiveRecoed::Base
>> has_many :www_links, :as => :owner
>> end
>>
>> class WwwLink < ActiveRecord::Base
>> belongs_to :owner, :polymorphic => true
>
class Foo < ActiveRecoed::Base
has_many :www_links, :as => :owner
end
class WwwLink < ActiveRecord::Base
belongs_to :owner, :polymorphic => true
attr_accessible :href
end
I want to ensure that each Foo instance does not have same links (href).
My first attempt would be to write validation
Thanks a lot guys! This is a piece of useful info :)
--
Posted via http://www.ruby-forum.com/.
--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from t
Hi,
http://programmers-blog.com/2010/12/21/quick-start-to-seo-for-ruby-on-rails
What do you think about this guys?
I looked through the whole Internet ;) and found nothing simple that
would suit my simple needs. So I did these things on my own and wrote
about the process.
Thanks for any comment
The speed is the same with or without RadRails.
--
Posted via http://www.ruby-forum.com/.
--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this g
When I run script/console I have to wait like 10 seconds to the console
to start.
When I run any of the tests in my rails app ('rake test' or whatever
else like AltShiftX+U in RadRaild) I also have to wait about
7-10 seconds for the testing itself to start.
This slows down my continues-developmen
Kura Monni wrote:
> current_user is defined in the ApplicationController class and it's set
> as a helper_method, but apparently it's still not visible in the Webrat
> steps.
Check this out
http://programmers-blog.com/2010/04/21/cucumber-vs-webrat-vs-current_user-from-authenticatedsystem
PS. S
Hi.
The file
/rails/activesupport/lib/active_support/json/encoders/enumerable.rb
Has:
class Array
(...)
def as_json(options = nil) #:nodoc:
self
end
end
I want a as_json method FooModel.all.as_json(:only => [...]) that will
work same as FooModel.first.as_json(:only => [...]).
I had t
Hi.
Any way to write this more efficiently? Can I make the active record
handle this through some kind of association?
@images = []
current_user.foo_models.each do |foo|
@images.concat(foo.images)
end
Any help appreciated.
--
Posted via http://www.ruby-forum.com/.
--
You re
Hi,
I am using rails 2.3.4..
Any idea how to implement such thing?:
def secondary_menu_link_to(link_name, link_path)
if (link_path is the current @controller.controller_path and
@controller.action_name)
link_to "&racuo; #{link_name}", link_path
else
link_to link_name, link_
Marnen Laibow-Koser wrote:
> In my opinion, integration tests are a bit clumsy. Cucumber features
> will be easier to work with, and will also address the issues you were
> asking about.
>
>>
>> Thanks in advance.
>>
>> M.
Looks nice, I'll check it deeper. Thanks.
My fiend found another si
Ok, I have the answer figured out for the quesion "how to specify ID":
assert_redirected_to '/my_models/edit_photos/' +
assigns(:my_model).id.to_s
But I still dont know how to avoid hardcoded paths.
I want to replace:
get '/foo/bar'
with something like:
get :controller => :foo, :action =>
I think you need AJAX here to populate the cascade "rest of the drop
downs" or refresh the whole page on change of the first drop down and
feed the collection_seelct in the controller with appropriate data.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~
Hi,
--- ROUTING ---
I have roting defined as RESTful but for the below testes MyModels
controller I have a standard
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
SAMPLE TEST --
class MyIntegrationTest < ActionController::IntegrationTest
fixt
Ok, it is working, change git:// to http:// and add a trailing / to the
URL.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this gr
I tried this, but its still not doing everything:
woj...@wojtek-laptop-hp:~/workspace_galileo/miejscowki$ ruby
script/plugin install http://github.com/ewildgoose/render_component.git/
-r rails-2.3
+ ./README
+ ./Rakefile
+ ./init.rb
+ ./lib/components.rb
+ ./test/abstract_unit.rb
+ ./test/compo
Hi.
I try to install a plugin, but with no success, nothing is printed, the
plugin is not installed. Input and output on my console:
woj...@wojtek-laptop-hp:~/workspace_galileo/miejscowki$ script/plugin
install git://github.com/ewildgoose/render_component.git -r rails-2.3
woj...@wojtek-laptop-hp
Hi,
Rails 2.3.3 + restful_authentication.
current_user is a method from lib/authenticated_system.rb through
"include AuthenticatedSystem" in application_controller.rb
home/_current_user.pl.html.erb :
<% if current_user %>
NOT NIL
<% else %>
NIL
<% end %>
home/
http://docs.jquery.com/Using_jQuery_with_Other_Libraries
I sometimes use this, this is a litle bit of topic but it may help
sometimes.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Goo
Hi,
Rails 2.3.2
class TestD < ActiveRecord::Base
default_scope :limit => 12
named_scope :limit, lambda { |num| { :limit => num} }
end
ruby script/console
>> TestD.all
TestD Load (0.7ms) SELECT * FROM "test_ds" LIMIT 12
=> []
>> TestD.limit(14)
TestD Load (0.3ms) SELECT * FROM "test
Thanks!
How do you process the image in the model?
Before the save of the model object to database I want to add another
image to it, that is a modified version of the "image" attribute.
I do:
has_attached_file :image
has_attached_file :image2
after_validation :prepare_image2
And:
def
Hi,
Rails 2.3.2, paperclip 2.2.9.2
How can I unit test my model that has a paperclip attachment?
I add to my model:
--- CODE START ---
has_attached_file :image, :default_url => ''
attr_protected :image_file_name, :image_content_type, :image_image_size
--- CODE END ---
Than I type a UNIT test:
Hi,
Is there any way to specify a a validation rule or something for the
"has_many' relationship so that it would count the related objects?
For e.g. I want my Foo object to have maximum of 5 Bar objects in
has_many relationship.
M.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--
Fernando Perez wrote:
>
> I personally type: rake test:coverage and it works fine.
I have no such task.
You probably use
http://clarkware.com/cgi/blosxom/2007/01/05/RcovRakeTask
But this generates separate coverage results for each test bundle. I
want a overall one.
M.
--
Posted via http://w
My friend found a workaround solution.
If anybody is interested its posted here
http://programmers-blog.com/2009/06/05/rconv-rails-rake-task-test-test-rcov-overwrites-its-output
M.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this
Hi,
rake test:test:rcov
This outputs to my console proper results. All test are run and coverage
percentage differs when running functional/integration/unit tests.
But at the and I get only one folder "coverage/test" with the last
results in HTML format.
The logs of the plugin say (3 times):
(
MaurĂcio Linhares wrote:
> http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping
Thats it! Thanks!
M.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Hi,
1.
I have my model for e.g. "Car".
I used this model in lots of places.
2.
In a migration I added Car.is_visible default => false.
3.
Now I wan all of the finder methods to take this flag under
consideration. So initaly none of the Cars will be displayed on my site.
I will have to look for
Hi,
test "is_admin method is not visible" do
get :is_admin
assert_???
end
is_admin is protected and should stay that way forever. What assertion
do I use?
M.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this messa
>
> LOL what's the permission policy?
>
> Whichever user is running the app needs write access if you want to
> write files, unless I'm seriously mistaken.
>
> Julian.
Whatever, I don't know what could it mean. I'm not that familiar with
rails unfortunately.
The problem is that after migrati
The problem is probably something similar to
http://blog.methodmissing.com/2008/1/19/edge-callback-refactorings-attachment_fu/
In my case the method process_attachment defined as a after_validation
callback doesn't get called for the second attachment of my model.
I replaced beginning of the me
Julian Leviston wrote:
> His problem is most likely a permissions issue.
>
Did the "permission policy" between rails 2.1 and 2.3 change?
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
Hi,
After upgrade to Rails 2.3.2 I have a problem with attachments.
After uploading the attachment in the images table there is a new
record. But the file does not exist on the file system.
has_attachment :content_type => :image,
:storage => :file_system,
:size =
35 matches
Mail list logo