search for: szimek

Displaying 20 results from an estimated 20 matches for "szimek".

Did you mean: simek
2008 Apr 17
4
Do I need to use sessions if I don't store anything in them?
Hi, I got very small app that has user part and admin part. The problem is that after a while the sessions table has ~150mb. I don''t really need to store any user data in the session for the user part. I only need it for the admin part. Can I simply turn session off in controllers from the user part? Are there any drawbacks of turning the session off? Regards
2008 Dec 02
2
ActiveResource - xml and json format return different results
Hi, I''m using Rails 2.1.2. and I wanted to switch ActiveResource format to JSON and thought that it will work smoothly, but unfortunately it wasn''t the case. XML and JSON formats generate different objects: XML version #<User:0xb7658440 @prefix_options={}, @attributes={"created_at"=>Mon Nov 28 11...}> JSON version #<User:0xb746af5c @prefix_options={},
2008 Mar 01
2
How to cache data in a plugin
Hi, I''m using CountryCodes to get countries list for select box. It provides self.countries_for_select(*args) method exactly for this purpose. I''m using it in only one place in my view. So I was thinking about caching this data somehow, so it won''t have to be recreated every time the page is loaded. The problem is that the plugin initializes its main @countries
2008 May 28
1
Attachment_fu, polymorphism and customization
Hi, I got Image model that has_attachment and belongs_to 2 other models via polymorphic association. The problem is that I''d like to customize has_attachment options (resize image) depending on which model the Image is related to - i.e. if Image belongs to Article it should be resized using different settings than if it belongs to Header. Is there a smart way to do it or do I have to
2008 Jul 04
2
How to make WHERE foo_id IN () query?
Hi, There are 3 models: A has_many :Cs B has_many :Cs C belongs_to A and B I got a single object of A and an array of B objects. How can I get all Cs that have a_id equal to object A.id *and* b_id that belongs to an object in Bs array? Regards --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2008 Nov 05
1
Constants in models are initialized before fixtures are loaded?
Hi, here''s simplified code from the model: class Foo < AR::Base FIRST = Foo.first.id end The problem is that when testing I get well known error: "Called id for nil...". I guess that this constant is initialized before the fixtures are loaded. Is there any way to fix it? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are
2008 Apr 01
1
"Undefined method merge" when using sweeper
Hi, I''m trying to use sweepers for the first time and got a problem - I get "undefined method `merge'' for "/signature/ f2d7c7c66450b169.html":String". The "/signature/f2d7c7c66450b169.html" part of the error message is the cached page. Here''s my sweeper: class FooSweeper < ActionController::Caching::Sweeper observe Foo def
2008 Jun 13
2
Rails 2.1.0 - find with :include and missing JOIN in SQL query
Hi, We''re trying to rewrite veeeery old Rails app that we successfully managed to move to 1.2.6 and now we''re trying with 2.1.0. One of the problems is caused by :include in AR.find. Rails 1.2.6 generates totally different SQL query than 2.1.0. Here''s Rails find query and generated SQL queries: Foo.find(:all, :include => :ticket, :conditions =>
2011 Mar 18
6
how to rescue this exception
hi,i don''t know how to capture the following exception if the file directory or name is not correct. ########## def index @csv_array=[] begin CSV.foreach(''files/sample.csv'') do|row| sub_array=row @csv_array<<sub_array end rescue Exception=>e flash.now[:error]="error:#{e}" raise end end ######### after
2012 Sep 25
3
Proposal for a new ActiveModel::Errors structure
There are few issues with the current ActiveModel::Errors class. Firstly, when an error is added to ActiveModel::Errors class via #add method (https://github.com/rails/rails/blob/master/activemodel/lib/active_model/errors.rb#L294) its translation is added. It should not be translated when being added, but only when being read. The second issue is a bit bigger. We''d like to create
2008 Mar 10
0
How to set permissions for public folder?
Hi, I''m using deprec+capistrano to deploy my app. The problem is that everything is assigned to the user (and his group) that the application was deployed by. This causes problems with i.e. caching, because mongrel can''t write inside public dir. How should I set permissions for public directory? --~--~---------~--~----~------------~-------~--~----~ You received this message
2008 Apr 15
0
How to cache dynamic CSS (RCSS)?
Hi, I''m using this tutorial: http://blog.hasmanythrough.com/2006/3/23/dirt-simple-rcss-templates to make dynamic CSS files. However I can''t figure out how expire cached CSS files. Here''s my code: http://pastie.caboo.se/181021. Most of it is copied from the tutorial. Files are cached properly - i.e. <%= stylesheet_link_tag "main" %> generates
2008 May 19
0
How to fetch a block provided by content_for in a helper?
Hi, I got a title_tag helper that renders default page title or title provided by content_for block, if such block is present. Currently I call this method like this: "title_tag(yield(:title))". Is it possible to fetch :title block inside the helper without explicitly passing it as a parameter to this helper? --~--~---------~--~----~------------~-------~--~----~ You received this
2008 May 21
0
Problem with alias_method in a plugin
Hi, I''m doing my first plugin, based on attachment_fu structure. Here''s the code: http://pastie.caboo.se/200797. The problem is that the meta_tag method doesn''t seem to be overwritten. I can call model_instance.original_meta_tag and it return same thing as model_instance.meta_tag, so the aliasing works. I can call model_instance.foo and it correctly returns class of
2008 Jun 02
0
Rails 2.1 - when PostsController is present, creating Admin::PostsController fails
Hi, just found out small problem with Rails 2.1. If I run a "script/generate scaffold post title:string" that creates PostsController and later want to make admin controller for it by running "script/generate controller admin/posts", Rails complain that: "The name ''Admin::PostsHelper'' is either already used in your application or reserved by Ruby on
2008 Oct 22
1
Sending thousands of email with ar_mailer
Hi, to send an email with ar_mailer I need to generate it and save it to the db, right? Currently the code looks very simple: Newsletter.recepients.each do |recepient| NewsletterMailer.deliver_dedicated(request, recepient, newsletter) end But for i.e. 30000 receivers it''s going to take a long while anyway. Should I create them somehow in the background using BackgrounDRb or something
2010 Mar 05
0
Strange error on the first request - trying to setup Rails 2.3.5 with Bundler
I''m trying to use Bundler for existing Rails 2.3.5 app and got a very strange problem. The problem is that on the very first request only the contents of the action view file are rendered - i.e. when loading the home page (controller: home, action: index) I get only contents of the app/views/ home/index.html.haml file as the response with no layout at all. On the second and on subsequent
2010 Apr 22
0
How to automatically set params based on passed object when generating a route?
Hi, having i.e. a post model that has many categories - is it possible for member routes like i.e. post_path(post) to generate path like "/ posts/:post_category_name/:post_id" without manually passing the category param? Does anyone know if there''s a gem or if I can simply override the post_url method to automatically set category from post object? The best I could get right
2011 Aug 19
0
Rails 3.1 reversible migrations and change_table
Hi, is the following migration really supposed to be irreversible? class AddColumnsToUsers < ActiveRecord::Migration def change change_table :users do |t| t.integer :foo t.integer :bar end end end I''m using Rails 3.1 RC6 and when trying to redo this migration I''m getting ActiveRecord::IrreversibleMigration error. Cheers, Szymon -- You received
2008 Mar 20
2
"can't activate activesupport" error
Hi, I''ve got a production server with rails 1.2.3 installed. Previously my app had frozen rails 1.2.3 as well. I decided to update frozen rails to 1.2.6. Deployment went fine until rake task was executed, which resulted in the following error: rake aborted! can''t activate activesupport (>= 1.4.4), already activated activesupport-1.4.2] On the server there''s