[Rails] Flaw in permalinking system.

2010-09-11 Thread youtube
Hi Basically I have a permalink system setup using the to_param method in the model file. Since I have a system in which categories has_many tutorials, my URLs look a bit like this: site.com/CatID-Category-Perma/TutID-Tutorial-Perma I have a system to redirect when the user puts in an ID to the

[Rails] Re: PostgreSQL 8.3 not storing 'Date' field type with Rails 3.0

2010-09-11 Thread Robert Pankowecki (rupert)
attr_accessible does not include the column maybe ? Could you post the code how you fill the column in the model via irb, the results of that and sql statement that gests executed ? Robert Pankowecki -- You received this message because you are subscribed to the Google Groups Ruby on Rails:

[Rails] Re: Need an online payment system - suggestions required

2010-09-11 Thread tonypm
On Sep 6, 3:52 am, Christian Fazzini christian.fazz...@gmail.com wrote: Hello all, We are about to launch our site. One of the features that is missing at the moment is a way for users to fill in their credit card details and click send to purchase our products that we offer on our website.

[Rails] Rails 2.3.x documentation archive?

2010-09-11 Thread Tom
Hi, I'm a developer on several projects using rails 2.3.4 and since the release of 3.0, I haven't been able to find any documentation for 2.3.4 online. I have the rdocs from the gem install, but haven't been able to find anything else. Is this stuff archived somewhere? Thanks! -Tom -- You

Re: [Rails] rails 3 backends

2010-09-11 Thread Kim Shrier
On Sep 10, 2010, at 2:54 PM, Kenneth Dunlap wrote: Are there any decent backends for rails 3? passenger is disqualified because of it's unfriendly install. I have a software distribution system. I don't compile software on production machines. mongrel2 is disqualified because it won't

[Rails] Re: Set table value

2010-09-11 Thread Frederick Cheung
On Sep 11, 3:18 am, Evanoshki Brataslavainskinski li...@ruby- forum.com wrote: Hi guys, I'm a newbie in ruby and I would just like to know how you set a value for a field in a table where session[:user_id] matches user.user_id. I am trying to do this from a submit form in the show.html.erb

[Rails] Re: Flaw in permalinking system.

2010-09-11 Thread Robert Pankowecki (rupert)
Just check if request.fullpath or request.path include tutpmlnk_path(:category_id = @tutorial.category, :id = @tutorial) string. If so render otherwise redirect to proper path. What do you think ? And btw ? Why is it so important ? Who visits the wrong links ? Robert Pankowecki -- You received

[Rails] Re: Cumulative Sum with will_paginate and activerecord

2010-09-11 Thread Frederick Cheung
On Sep 10, 7:50 pm, Fidel Viegas fidel.vie...@gmail.com wrote: On 9/10/10, radhames brito rbri...@gmail.com wrote: AR has a sum function. Hi Radhames, I am aware of the sum function, but it does not do cumulative sum on its own. I know how to do it using recursive queries or stored

[Rails] Re: Rails 2.3.x documentation archive?

2010-09-11 Thread Manish Nautiyal
Tom wrote: Hi, I'm a developer on several projects using rails 2.3.4 and since the release of 3.0, I haven't been able to find any documentation for 2.3.4 online. I have the rdocs from the gem install, but haven't been able to find anything else. Is this stuff archived somewhere?

Re: [Rails] Re: Cumulative Sum with will_paginate and activerecord

2010-09-11 Thread Fidel Viegas
On 9/11/10, Frederick Cheung frederick.che...@gmail.com wrote: On Sep 10, 7:50 pm, Fidel Viegas fidel.vie...@gmail.com wrote: On 9/10/10, radhames brito rbri...@gmail.com wrote: AR has a sum function. Hi Radhames, I am aware of the sum function, but it does not do cumulative sum on its

[Rails] Couldn't find User without an ID

2010-09-11 Thread Anders_P
Hello! I'm trying to create a list of user ads on my home page in my app. But I don't get it to work. I'm a rails noob so it might be something trivial. I'm currently running into this error: Couldn't find User without an ID My pages controller where to home action is looks like this: def

Re: [Rails] Couldn't find User without an ID

2010-09-11 Thread Colin Law
On 11 September 2010 11:34, Anders_P and...@andersplanting.se wrote: Hello! I'm trying to create a list of user ads on my home page in my app. But I don't get it to work. I'm a rails noob so it might be something trivial. I'm currently running into this error:  Couldn't find User without an

[Rails] Rails 3 helper method not called

2010-09-11 Thread Bosko Ivanisevic
While I was trying to port one application from Rail 2 to Rails 3 I've noticed that helper methods used for rewriting URL paths are not called. Methods are defined in app/helpers/url_helper.rb: module UrlHelper def story_pah(story) /story/#{story.title} end end This method, when called

[Rails] Re: Couldn't find User without an ID

2010-09-11 Thread Anders_P
Hello Colin! Thanks for your reply. You are right about where the error is occurring, this line is causing the error, @user = User.find(params[:id]). I haven't passed the id to the home action, where should i do that and how? Sorry for the noobish question but your help would be gold! On 11

Re: [Rails] Re: Couldn't find User without an ID

2010-09-11 Thread Colin Law
On 11 September 2010 12:14, Anders_P and...@andersplanting.se wrote: Could you not top post please, it is easier to follow the thread if comments are inserted into the previous post. Thanks Hello Colin! Thanks for your reply. You are right about where the error is occurring, this line is

[Rails] Re: Flaw in permalinking system.

2010-09-11 Thread youtube
I don't know what request.path or request.fullpath are, or how to check if they include my redirect thing (I'm a real RoR noob); but I'll be looking around files for them. As for why it's so important; firstly I still need to perfect the permalink system (remove some more punctuation), and don't

[Rails] Re: Flaw in permalinking system.

2010-09-11 Thread youtube
I don't know what request.path or request.fullpath are, or how to check if they include my redirect thing (I'm a real RoR noob); but I'll be looking around files for them. As for why it's so important; firstly I still need to perfect the permalink system (remove some more punctuation), and don't

[Rails] Re: Flaw in permalinking system.

2010-09-11 Thread youtube
I don't know what request.path or request.fullpath are, or how to check if they include my redirect thing (I'm a real RoR noob); but I'll be looking around files for them. As for why it's so important; firstly I still need to perfect the permalink system (remove some more punctuation), and don't

[Rails] Re: Rails 2.3.x documentation archive?

2010-09-11 Thread Marnen Laibow-Koser
Tom wrote: Hi, I'm a developer on several projects using rails 2.3.4 and since the release of 3.0, I haven't been able to find any documentation for 2.3.4 online. Then you haven't been looking very hard. :) We've had this discussion already, so you could have searched the list archives;

[Rails] Re: Manual Rake Tasks Question

2010-09-11 Thread Alpha Blue
I managed to do it by using f.puts to generate the log file and then read the file using a render in the view with link_to_remote. -- 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

Re: [Rails] Re: Need an online payment system - suggestions required

2010-09-11 Thread Bill Walton
Hi, On Sat, Sep 11, 2010 at 3:22 AM, tonypm tonypmar...@hotmail.com wrote: On Sep 6, 3:52 am, Christian Fazzini christian.fazz...@gmail.com wrote: Hello all, We are about to launch our site. One of the features that is missing at the moment is a way for users to fill in their credit card

[Rails] Re: Paperclip - 'identify' command.

2010-09-11 Thread Abder-Rahman Ali
I followed the issue following this: I just needed to replace the '#{m}' with \#{m} \ in the quote_command_options method. def quote_command_options(*options) options.map do |option| option.split(').map{|m| \#{m}\ }.join(\\') end end From:

[Rails] Re: Paperclip - 'identify' command.

2010-09-11 Thread Abder-Rahman Ali
Abder-Rahman Ali wrote: I followed the issue following this: I just needed to replace the '#{m}' with \#{m} \ in the quote_command_options method. def quote_command_options(*options) options.map do |option| option.split(').map{|m| \#{m}\ }.join(\\') end end

Re: [Rails] Re: Need an online payment system - suggestions required

2010-09-11 Thread Hassan Schroeder
On Sat, Sep 11, 2010 at 1:22 AM, tonypm tonypmar...@hotmail.com wrote: This question interests me too.  Strange not to have got any response to this This same question was asked on the Active Merchant mailing list (google group) and generated substantial discussion. Check the mailing list

Re: [Rails] Re: rails 3 backends

2010-09-11 Thread Kenneth Dunlap
Quoth Michael Schuerig (mich...@schuerig.de): On Friday 10 September 2010, Kenneth Dunlap wrote: Are there any decent backends for rails 3? Yes: passenger and mongrel are very decent backends. passenger is disqualified because of it's unfriendly install. I have a software

Re: [Rails] Re: rails 3 backends

2010-09-11 Thread Chris Mear
On 11 Sep 2010, at 15:26, Kenneth Dunlap wrote: Quoth Michael Schuerig (mich...@schuerig.de): On Friday 10 September 2010, Kenneth Dunlap wrote: Are there any decent backends for rails 3? Yes: passenger and mongrel are very decent backends. passenger is disqualified because of it's

[Rails] Re: Manual Rake Tasks Question

2010-09-11 Thread Alpha Blue
Okay, I wrote out some basic code to look at: http://gist.github.com/575243 This is just a basic example and here are my current issues and concerns: The view houses a link that I can click to run the example rake task. If I'm in development mode it runs in windows without opening an

[Rails] ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-11 Thread Andreas Schmidt
Hello, i got some strange behaviour here in my app i cannot work out. Maybe here someone knows a soloution for this? In the view: % @product.comments.each do |comment| % div class=comment p%= comment.created_at.to_s(:db) %/p /div % end % So the error i get is: wrong number of

[Rails] help in making a function inherited by all views

2010-09-11 Thread TEREN
I already asked it in the railsforum.com but it didn't quite got answered yet so instead of repeating the question heres a link: http://railsforum.com/viewtopic.php?id=40810 feel free answering either here or in the forums. -- You received this message because you are subscribed to the Google

Re: [Rails] Re: current_page? inside controller

2010-09-11 Thread radhames brito
did you solve your problem? On Fri, Sep 10, 2010 at 11:40 AM, Robert Pankowecki (rupert) robert.pankowe...@gmail.com wrote: I have 3 different type of addresses fot person. I can create and display them using same views currently (but that might change in the future) so I created one

Re: [Rails] Re: Need help on Dicom Image viewer

2010-09-11 Thread radhames brito
someone got this converted to jpg and then displayed on a view search the mailing list On Fri, Sep 10, 2010 at 1:57 PM, Marnen Laibow-Koser li...@ruby-forum.comwrote: A Sarkar wrote: DICOM is the image output of an X-ray machine. X ray plates are things of past. Radiologists all over the

Re: [Rails] Re: Need help on Dicom Image viewer

2010-09-11 Thread radhames brito
He had a path problem that was actually easy to solve and but he did convert the image I have created a Rails application based on this tutorial: http://dicom.rubyforge.org/tutorial1.html I'm trying to view a DICOM image. I was able to convert .dcm to .jpg. But, when I try to view the .jpg

Re: [Rails] Re: Polymorphic advice for this design

2010-09-11 Thread radhames brito
i think i dont understand very well because i think that what you are saying can be achieve with the code in the previous mail. this is how i show a user all his comments %...@user.comments.each |comment|% %=h comment.content% %end% and this is how i show a user all the products he has

Re: [Rails] Having difficulty with threaded comments, using acts_as_tree

2010-09-11 Thread radhames brito
your are doing a polimorphic assotiacion on the same model and another model , thats not needed, you only need a self referential association and a has many, your main problem is that you are using a polymorphic associations where there was no need to. you comment table should have t.integer

Re: [Rails] Having difficulty with threaded comments, using acts_as_tree

2010-09-11 Thread radhames brito
you site crashed because the comment on the page article are found by pulling the article_id from the params but you want to add childrens to a comment and there is no way to pull that id with the find_commentable function On Sat, Sep 11, 2010 at 12:47 PM, radhames brito rbri...@gmail.com wrote:

Re: [Rails] Connection refused - connect(2)

2010-09-11 Thread radhames brito
are you using rvm? On Sat, Sep 11, 2010 at 12:09 AM, Anthony Smith anth...@sticksnleaves.comwrote: I got this error this evening while running my specs: Connection refused - connect(2) I'm running under test/development and I'm using SQLite3. I didn't have this issue yesterday and my code

Re: [Rails] Re: Set table value

2010-09-11 Thread radhames brito
is user.id no user.user_id On Sat, Sep 11, 2010 at 4:33 AM, Frederick Cheung frederick.che...@gmail.com wrote: On Sep 11, 3:18 am, Evanoshki Brataslavainskinski li...@ruby- forum.com wrote: Hi guys, I'm a newbie in ruby and I would just like to know how you set a value for a field

[Rails] Adding an associated Table to an Existing Table (Book Revision)

2010-09-11 Thread nobosh
Hello, newbie here... I have the following models: class Instance ActiveRecord::Base has_many :users has_many :books end class User ActiveRecord::Base belongs_to :instance end class Book ActiveRecord::Base belongs_to :instance end I now want to add a BookRevision table, that has the

Re: [Rails] Re: Cumulative Sum with will_paginate and activerecord

2010-09-11 Thread radhames brito
add a hidden field with[] in them it will make the params create an array and put the ids of the paged record in them , then pass the array in a find and call sum on it. f.hidden :things, thing.id[] then find(params[:things]) On Sat, Sep 11, 2010 at 5:45 AM, Fidel Viegas

Re: [Rails] Re: Couldn't find User without an ID

2010-09-11 Thread radhames brito
home action seems to be a member restful action and it needs an id to find the record but you are not declaring that route the right way show the routes please On Sat, Sep 11, 2010 at 8:25 AM, Colin Law clan...@googlemail.com wrote: On 11 September 2010 12:14, Anders_P and...@andersplanting.se

Re: [Rails] Re: Paperclip - 'identify' command.

2010-09-11 Thread radhames brito
install imagemagick if you are in windows there is a problem with the command paperclip user since it call the shell as if is a linux shell and you get that errot try upgrading paperclip if it still not working , reply with a bit more info. but is mainly a problem with imagemagick On Sat, Sep

Re: [Rails] ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-11 Thread radhames brito
to_s formats with .strftime On Sat, Sep 11, 2010 at 10:30 AM, Andreas Schmidt railsa...@googlemail.comwrote: Hello, i got some strange behaviour here in my app i cannot work out. Maybe here someone knows a soloution for this? In the view: % @product.comments.each do |comment| % div

Re: [Rails] ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-11 Thread radhames brito
sorry i meant to say that dates format with .strftime not to_s On Sat, Sep 11, 2010 at 1:30 PM, radhames brito rbri...@gmail.com wrote: to_s formats with .strftime On Sat, Sep 11, 2010 at 10:30 AM, Andreas Schmidt railsa...@googlemail.com wrote: Hello, i got some strange behaviour

Re: [Rails] Adding an associated Table to an Existing Table (Book Revision)

2010-09-11 Thread radhames brito
you and to record every update or you overwrite when there is an update? On Sat, Sep 11, 2010 at 1:13 PM, nobosh bhellm...@gmail.com wrote: Hello, newbie here... I have the following models: class Instance ActiveRecord::Base has_many :users has_many :books end class User

[Rails] Re: Adding an associated Table to an Existing Table (Book Revision)

2010-09-11 Thread nobosh
I want to add a revision record on every update to the book record. Like how a wiki works. Every time the wiki is update it tracks a revision: http://upload.wikimedia.org/wikipedia/commons/4/41/Mediawiki-database-schema.png On Sep 11, 10:34 am, radhames brito rbri...@gmail.com wrote: you and

Re: [Rails] help in making a function inherited by all views

2010-09-11 Thread radhames brito
explain what you want to achieve becuase what you are doing is confusing. What happens the most to rails beginners is that we over complicate, becuase we are used to complicated stuff in other frameworks and can believe that doing thing a simplified as rails does it would work, it appears this is

Re: [Rails] Re: Adding an associated Table to an Existing Table (Book Revision)

2010-09-11 Thread radhames brito
see if this helps http://railscasts.com/episodes/177-model-versioning On Sat, Sep 11, 2010 at 1:36 PM, nobosh bhellm...@gmail.com wrote: I want to add a revision record on every update to the book record. Like how a wiki works. Every time the wiki is update it tracks a revision:

[Rails] rails production no public directory

2010-09-11 Thread jeljer te Wies
Hi guys.. I am deploying a new rails 3 app. For this i am using rails 3, thin and apache. But for hours now i have a problem with the public dir. It cannot be accessed beceause it is filtered by the route file. I have in my routes file the following: match '/:id(/*path)' = websites#index it is

[Rails] Re: Cumulative Sum with will_paginate and activerecord

2010-09-11 Thread Agoofin
Or include a separate variable with the sum you want to include in addition to the will_paginate variable. @figures = Figures.paginate... @figure_sum = Figures.sum(... On Sep 11, 1:13 pm, radhames brito rbri...@gmail.com wrote: add a hidden field with    []  in them it will make the params

[Rails] Re: rails production no public directory

2010-09-11 Thread Frederick Cheung
On Sep 11, 6:41 pm, jeljer te Wies li...@ruby-forum.com wrote: Hi guys.. I am deploying a new rails 3 app. For this i am using rails 3, thin and apache. But for hours now i have a problem with the public dir. It cannot be accessed beceause it is filtered by the route file. I have in my

Re: [Rails] Connection refused - connect(2)

2010-09-11 Thread Anthony Smith
It was a Sunspot issue. Thanks for the response though! On Sep 11, 2010, at 1:05 PM, radhames brito wrote: are you using rvm? On Sat, Sep 11, 2010 at 12:09 AM, Anthony Smith anth...@sticksnleaves.com wrote: I got this error this evening while running my specs: Connection refused -

[Rails] Re: Re: Paperclip - 'identify' command.

2010-09-11 Thread Abder-Rahman Ali
Thanks @radhames. As yo cn see I have included a workaround to be working for the mean while. -- 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

[Rails] Re: rails production no public directory

2010-09-11 Thread jeljer te Wies
Well i Tried to do It with apache. I did it with setting directory. But this didn't work. I have been trying to solve It with apache for hours. What should I set in my virtualhost ? Gr -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the

[Rails] Re: Adding an associated Table to an Existing Table (Book Revision)

2010-09-11 Thread nobosh
Vestal Versions looks pretty impressive, only challenge is it doesn't seem to play nice with Rails 3. ActiveRecord::DangerousAttributeError: changes is defined by ActiveRecord It uses a field in the model called changes. Not sure if there are plans to fix that or not. On Sep 11, 10:40 am,

[Rails] Re: Couldn't find User without an ID

2010-09-11 Thread Anders_P
Thanks for your tips Colin! Hi radhames! Thanks for your help on my previous topic. Here is my routes.rb file: resources :users resources :sessions, :only = [:new, :create, :destroy] resources :ads, :only = [:new, :create, :destroy] match '/registrera', :to = 'users#new'

[Rails] Can't install plugins on rails 3.0

2010-09-11 Thread Ed
Just upgraded one of my apps to Rails 3.0 and I cannot install plugins. I either get Plugin not found, or an empty folder. When I run rails plugin --verbose install http://github.com/jslag/us-state-select-plugin.git I get this response: Plugins will be installed using http git init git pull

[Rails] Re: Adding an associated Table to an Existing Table (Book Revision)

2010-09-11 Thread nobosh
To install Vestal Versions, after adding the gem you have to run: script/generate vestal_versions not sure if that's a Rails 3 command so I tried: rails generate vestal_versions which gave Could not find generator vestal_versions I did check to make sure it was installed: $ bundle show

[Rails] Re: Adding an associated Table to an Existing Table (Book Revision)

2010-09-11 Thread nobosh
Also tried: rails g vestal_versions Could not find generator vestal_versions Anyone out there able to get Vestal Versions working with Rails 3? On Sep 11, 11:30 am, nobosh bhellm...@gmail.com wrote: To install Vestal Versions, after adding the gem you have to run: script/generate

[Rails] Re: current_page? inside controller

2010-09-11 Thread Robert Pankowecki (rupert)
Yes. It works ok with code that look something like that : request.fullpath.include?(mailing_addresses_path) Robert Pankowecki -- 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

[Rails] Re: Flaw in permalinking system.

2010-09-11 Thread Robert Pankowecki (rupert)
`request' is a method available in your controller. It returns ActionDispatch::Request instance. `fullpath and `path' are method that can be called on `request' instance. You might wanna try friendly_id . http://ruby-toolbox.com/categories/rails_permalinks___slugs.html It has the feature that

[Rails] DICOM to JPG using Paperclip

2010-09-11 Thread Abder-Rahman Ali
Is there a way to convert a DICOM file to JPG using Paperclip? Thanks. -- 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

[Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-11 Thread Andreas Schmidt
Hello radhmes brito, as you can see here: http://api.rubyonrails.org/classes/ActiveSupport/TimeWithZone.html it is possible to output a formatted like i tried. You can simply set it up in /config/initializeres/time_formats.rb like this: Time::DATE_FORMATS.merge!( :mydate = '%d.%m.%Y' ) Then

[Rails] slow rails environment load for unit tests, etc on windows

2010-09-11 Thread E
Hi, I'm using windoze 7 and rails 3.0. Running my unit tests takes a very long time for the rails environment to load... somewhere around 20 seconds, maybe more. I have seen references to using faster_require... i have done the gem install for that, but have no clue what to do with it. Am I

[Rails] Autotest on Windows

2010-09-11 Thread zYan1de
Hello I use Windows 7 and I can't run Autotest, When i try to run autotest in my rails app dir, all that gets outputted is loading autotest/rails then nothing.. No text, no errors, no nothing... Does anybody know what's causing this? -- You received this message because you are subscribed to

[Rails] Re: help in making a function inherited by all views

2010-09-11 Thread Alpha Blue
TEREN wrote: I try to make a table in the database where all my texts are in so i could add another column one day for a different language so when I do decide to translate my site to a different site it would be a matter of adding a column to a table. (BTW I intend to put all the data in my

[Rails] Re: DICOM to JPG using Paperclip

2010-09-11 Thread Abder-Rahman Ali
I used this: has_attached_file :image, :styles = { :original = [ 100%, :jpg ] } From: http://groups.google.com/group/paperclip-plugin/browse_thread/thread/6764f7705242289c/be8b6751833480fd?lnk=gstq=conversion#be8b6751833480fd And it worked. -- Posted via http://www.ruby-forum.com/. -- You

Re: [Rails] Re: rails 3 backends

2010-09-11 Thread Kenneth Dunlap
Quoth Chris Mear (chrism...@gmail.com): On 11 Sep 2010, at 15:26, Kenneth Dunlap wrote: Quoth Michael Schuerig (mich...@schuerig.de): On Friday 10 September 2010, Kenneth Dunlap wrote: Are there any decent backends for rails 3? Yes: passenger and mongrel are very decent backends.

[Rails] vestal_versions, user_id

2010-09-11 Thread nobosh
Anyone using vestal_versions: http://github.com/adamcooper/vestal_versions/ How do you set the user_id in the versions table? tried: in: def update @book.version.user_id(@current_user.id) and @book.user_id(@current_user.id) both error thanks -- You received this message because you are

[Rails] belongs_to two different people

2010-09-11 Thread Brian Ablaza
I have a People table and a Tasks table. Some People are Managers, some are Workers. Each Task has a Manager and a Worker. How do I define the relationships? I tried a STI setup, where Managers and Workers inherit from People, and People has a type column. In my Task table, I have worker_id and

Re: [Rails] belongs_to two different people

2010-09-11 Thread Daniel Gaytán
I think this could work: class Task ActiveRecord::Base belongs_to :worker belongs_to :manager end class Person ActiveRecord::Base end class Manager Person has_many :tasks end class Worker Person has_many :tasks end task = Task.create manager = Manager.create worker = Worker.create

Re: [Rails] Re: Couldn't find User without an ID

2010-09-11 Thread radhames brito
ok there is a problem @user = User.find(params[:id]) = params[:id] is pulled from the url query string in rails the convention is this /controller/action/id in cases there you need to pull one specific record /controller/action to pull a collection @user =

Re: [Rails] Can't install plugins on rails 3.0

2010-09-11 Thread radhames brito
use bundler , spcify the git url in you gemfile On Sat, Sep 11, 2010 at 2:24 PM, Ed haywood...@gmail.com wrote: Just upgraded one of my apps to Rails 3.0 and I cannot install plugins. I either get Plugin not found, or an empty folder. When I run rails plugin --verbose install

Re: [Rails] Re: Adding an associated Table to an Existing Table (Book Revision)

2010-09-11 Thread radhames brito
well im going to sleep now but ill check it out tomorrow On Sat, Sep 11, 2010 at 2:35 PM, nobosh bhellm...@gmail.com wrote: Also tried: rails g vestal_versions Could not find generator vestal_versions Anyone out there able to get Vestal Versions working with Rails 3? On Sep 11, 11:30 am,

Re: [Rails] Re: current_page? inside controller

2010-09-11 Thread radhames brito
with this :requirements = { :context_type = 'addresses'} and then in you controller check context_type == addresses its checked by the router instead of the controller On Sat, Sep 11, 2010 at 2:35 PM, Robert Pankowecki (rupert) robert.pankowe...@gmail.com wrote: Yes. It works ok with code

Re: [Rails] Re: ActiveSupport::TimeWithZone to_s(:format) not working in view?

2010-09-11 Thread radhames brito
i once used something like to_s(:mydate) but it never worked so i always go for the sure thing. can you show the stack for both errors? On Sat, Sep 11, 2010 at 3:37 PM, Andreas Schmidt railsa...@googlemail.comwrote: Hello radhmes brito, as you can see here:

Re: [Rails] slow rails environment load for unit tests, etc on windows

2010-09-11 Thread radhames brito
what db are you using? On Sat, Sep 11, 2010 at 12:41 PM, E elliot.g...@gmail.com wrote: Hi, I'm using windoze 7 and rails 3.0. Running my unit tests takes a very long time for the rails environment to load... somewhere around 20 seconds, maybe more. I have seen references to using

Re: [Rails] belongs_to two different people

2010-09-11 Thread Daniel Gaytán
I forgot to mention that you must to define a default scope for getting first all Managers or Workers in each case and a before create filter to set the role the person you are creating will have or whatever: #manager.rb before_create :set_manager_role default_scope :where = {:role = manager}

Re: [Rails] Re: help in making a function inherited by all views

2010-09-11 Thread radhames brito
if you want a variable db schema go with mongodb , but i dont think thats what you really want, i think is easier to have a polimorphic text table that can belong to the models that contain text and pull depending on the locale. watch a schema less database here

Re: [Rails] vestal_versions, user_id

2010-09-11 Thread radhames brito
this does not work? @book.version.user_id = @current_user.id? On Sat, Sep 11, 2010 at 8:23 PM, nobosh bhellm...@gmail.com wrote: Anyone using vestal_versions: http://github.com/adamcooper/vestal_versions/ How do you set the user_id in the versions table? tried: in: def update

[Rails] Re: vestal_versions, user_id

2010-09-11 Thread nobosh
Rails error'd on that Error Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id On Sep 11, 8:20 pm, radhames brito rbri...@gmail.com wrote: this does not work? @book.version.user_id = @current_user.id    ? On Sat, Sep 11, 2010 at 8:23

Re: [Rails] belongs_to two different people

2010-09-11 Thread radhames brito
script/generate migration add_roles_mask_to_users roles_mask:integer rake db:migrate # in models/user.rb ROLES = %w[Manager Worker] def roles=(roles) self.roles_mask = (roles ROLES).map { |r| 2**ROLES.index(r) }.sum end def roles ROLES.reject do |r| ((roles_mask || 0)

Re: [Rails] belongs_to two different people

2010-09-11 Thread radhames brito
i like this olution because roles can grow easily On Sat, Sep 11, 2010 at 11:29 PM, radhames brito rbri...@gmail.com wrote: script/generate migration add_roles_mask_to_users roles_mask:integer rake db:migrate # in models/user.rb ROLES = %w[Manager Worker] def roles=(roles)

Re: [Rails] Re: vestal_versions, user_id

2010-09-11 Thread radhames brito
that means current user is nil check that out On Sat, Sep 11, 2010 at 11:25 PM, nobosh bhellm...@gmail.com wrote: Rails error'd on that Error Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id On Sep 11, 8:20 pm, radhames brito

[Rails] Re: vestal_versions, user_id

2010-09-11 Thread nobosh
If I update the code to: @current_userid = current_user.id @note.version.user_id = @current_userid Rails3 seems like that better, the error is now: undefined method `user_id=' for 1:Fixnum On Sep 11, 8:25 pm, nobosh bhellm...@gmail.com wrote: Rails error'd on that Error Called id for

Re: [Rails] Re: vestal_versions, user_id

2010-09-11 Thread radhames brito
@note.version is a number, is the version number, you are pulling the wrong property On Sat, Sep 11, 2010 at 11:31 PM, nobosh bhellm...@gmail.com wrote: If I update the code to: @current_userid = current_user.id @note.version.user_id = @current_userid Rails3 seems like that better, the

Re: [Rails] Re: vestal_versions, user_id

2010-09-11 Thread radhames brito
let me see the railscast to remember how to use it On Sat, Sep 11, 2010 at 11:34 PM, radhames brito rbri...@gmail.com wrote: @note.version is a number, is the version number, you are pulling the wrong property On Sat, Sep 11, 2010 at 11:31 PM, nobosh bhellm...@gmail.com wrote: If I update

Re: [Rails] Re: vestal_versions, user_id

2010-09-11 Thread radhames brito
there is another gem that can help you since it save the user that made the change automaticly is called acts_as_audited i think it does exactly what you want. http://github.com/collectiveidea/acts_as_audited On Sat, Sep 11, 2010 at 11:34 PM, radhames brito rbri...@gmail.com wrote: let me

Re: [Rails] Re: vestal_versions, user_id

2010-09-11 Thread radhames brito
well this gem does not rollback like vestal_versions On Sat, Sep 11, 2010 at 11:48 PM, radhames brito rbri...@gmail.com wrote: there is another gem that can help you since it save the user that made the change automaticly is called acts_as_audited i think it does exactly what you want.

[Rails] Re: vestal_versions, user_id

2010-09-11 Thread nobosh
Thanks radhames but I'm not trying to implement auditing. I'm trying to create a wiki like system for books so I have versioning, which is what vestal_version does. The 'acts_as_audited' is more about creating an audit trail of all activity and isn't about seeing past versions, reverting etc...

Re: [Rails] Re: vestal_versions, user_id

2010-09-11 Thread radhames brito
oh , ok, i think you can also edit the versions table by altering the migration that way you can create an association, but im not done watching the railscast On Sat, Sep 11, 2010 at 11:52 PM, nobosh bhellm...@gmail.com wrote: Thanks radhames but I'm not trying to implement auditing. I'm

Re: [Rails] Re: vestal_versions, user_id

2010-09-11 Thread radhames brito
http://github.com/laserlemon/vestal_versions/issues#issue/25 On Sat, Sep 11, 2010 at 11:54 PM, radhames brito rbri...@gmail.com wrote: oh , ok, i think you can also edit the versions table by altering the migration that way you can create an association, but im not done watching the railscast

[Rails] Re: vestal_versions, user_id

2010-09-11 Thread nobosh
That's good. Seems to confirm that you can record the updated_by on updates. The user's issue in the link was he wants a version for the 1st record created which isn't something I'm worried about since that's in the books table. So some how that user by the updated_by to work and populate the