[Rails] howto reload changes using script/console ?

2010-08-30 Thread Allen Walker
I am using script/console to debug, but when I make some changes to say a helper and rerun the method, it doesn't reload the new changes. "reload!" doesn't work - it only updates model changes. Suggestions? TIA -- Posted via http://www.ruby-forum.com/. -- You received this message because you ar

[Rails] rake task can't find installed gems

2010-08-23 Thread Allen Walker
I'm running a rake task and it complains there are "Missing gems" even though they are indeed installed. However from further inspection, it appears it is not looking in my GEM PATH (/usr/local/lib/ruby/1.8) but instead is looking in /usr/lib/ruby/gems/1.8. my gem env: RubyGems Environment: - R

[Rails] Re: gem location problem from rake task

2010-08-20 Thread Allen Walker
BTW when I do "gem list" the gem appears: # gem list al...@ubuntu:~/www/lines$ gem list *** LOCAL GEMS *** actionmailer (2.3.8) actionpack (2.3.8) activerecord (2.3.8) activeresource (2.3.8) activesupport (2.3.8) authlogic (2.1.3) bcrypt-ruby (2.1.2) crack (0.1.6) devise (1.0.8, 1.0.7) devise_in

[Rails] gem location problem from rake task

2010-08-20 Thread Allen Walker
I have installed the following gem which is in my environment.rb. However when I try to run a rake task, it gives the error: environment.rb config.gem "devise_invitable", :version => '0.2.3' $ rake mytasks:task (in /home/allen/www/lines) DEPRECATION WARNING: Rake tasks in vendor/plugins/paperclip

[Rails] Re: has_many :through question

2010-08-18 Thread Allen Walker
Disregard, solution found. -- 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 group, send email to r

[Rails] has_many :through question

2010-08-18 Thread Allen Walker
I am trying to create an association table using the ":through" option in "has_many" but not having success. I have created the necessary migrations of the association tables and run rake db:migrate I have the following model: class Group < ActiveRecord::Base has_many :users, :through => :group

[Rails] comments / blogging gem ?

2010-06-09 Thread Allen Walker
Currently I'm using "acts_as_commentable" which is fine, but I wonder if there is something better and more robust out there as a replacement. On my site I allow people to post news articles etc that are commentable. Thanks in advance -- Posted via http://www.ruby-forum.com/. -- You received th

[Rails] Unit Testing with ActiveRecord External Database Tables

2010-03-01 Thread Allen Walker
I want to perform unit tests but the model object in question is actually linked to an external database table. So I don't actually have the database table in my local database which I need to run unit tests. Any ideas on how to approach this? I have created a sample fixtures yml file that has a su

[Rails] find_in_batch and postgres hanging

2009-12-28 Thread Allen Walker
Running the command: Event.find_in_batches(:conditions => ["gw_out_time + interval '60 days' > now()"]) is causing a virtual hang. Not even control C will break it. If I remove the "interval '60 days'" part, it works fine. Note this query works fine is psql. Ideas? Thanks in advance -- Posted

[Rails] to_xml and timezones

2009-09-08 Thread Allen Walker
When i call model_object.to_xml, there is a DateTime field and it's displayed as such: 2009-08-25T16:32:06Z Is there anyway to modify the display format to say the format like Time.now.utc?, i.e. 2009-09-09 03:14:20 UTC thanks -- Posted via http://www.ruby-forum.com/. --~--~-~--~~-

[Rails] Re: has_and_belongs_to_many refer to same Model

2009-08-25 Thread Allen Walker
Thanks. one thing I noticed is that it's ":class_name" not just ":class" (2.3.3) Rick Denatale wrote: > > You need to give the association a different name, and a few other > things > > class User >has_and_belongs_to_many :friends, > :class => "

[Rails] has_and_belongs_to_many refer to same Model

2009-08-24 Thread Allen Walker
I have a User model and in I want to have a has_and_belongs_to_many :users Obviously that won't work since the join table will have the same column names (user_id). What approach should I take? thanks -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~-

[Rails] Re: link_to_remote question

2009-08-12 Thread Allen Walker
Found the problem: You need to put <%= javascript_include_tag :defaults %> as the last javascript_include_tag in the layout -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

[Rails] Re: link_to_remote question

2009-08-12 Thread Allen Walker
One thing I forgot to add, I have a nested div actually b/c my layout has a div. So the above is really Could this be the problem? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go

[Rails] link_to_remote question

2009-08-12 Thread Allen Walker
I have the simple view page: <%= link_to_remote "Turn on Alert", :url => {:controller => "alerts", :action => "new"} :update => "test1" %> Then in my controller I simply do if request.xhr? render :text => "AJAX Called" else redirect_to :back end It's hitting the request.xhr? block as I h

[Rails] Commenting / Blog gem or plugin?

2009-08-11 Thread Allen Walker
Searching around if there is a good commenting / blog plugin or gem to use in my app. Would rather use one than reinvent the wheel. Something like where a user can comment on a specific item in my model and have the display etc all built in. Any recommendations? thanks -- Posted via http://www.

[Rails] Re: initializers

2009-08-06 Thread Allen Walker
Sijo Kg wrote: > Hi > > Did you try the example I said. I tested it and working for console > and server starting (Not passenger) > > Sijo Yeah I got it working. Wish I could see the generated output to a logfile though. That would be useful -- Posted via http://www.ruby-forum.com/. --~--

[Rails] Re: initializers

2009-08-06 Thread Allen Walker
Sijo Kg wrote: > Hi > >You have to specify where to log for example if want to console > vcan do like > > logger = Logger.new(STDOUT) > logger.info("Running tasks") > > > > Sijo When I do a "script/console" the initializers run. But when I fire up the web server/rails (passenger) they

[Rails] initializers

2009-08-05 Thread Allen Walker
I created a "config/initializers/tasks.rb" In it I have the following is all: logger.info("Running tasks") However nothing is logged or run. Am I missing something? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message becaus

[Rails] Re: ActiveRecord question

2009-02-20 Thread Allen Walker
LOL thanks. i drank too much last night i guess. Maurício Linhares wrote: > You're missing the "each" call. > > > On Fri, Feb 20, 2009 at 4:54 PM, Allen Walker -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You re

[Rails] ActiveRecord question

2009-02-20 Thread Allen Walker
This is strange: I'm doing the following in script/console: >> Contract.find(:all) do |c| >> ?> if c.use_initial_published_date >> c.initial_published_date = Date.today >>

[Rails] Re: Fire submit when drop down box item clicked

2009-02-16 Thread Allen Walker
#x27;sku_name').observe('click', function(event){ alert(Event.element(event).innerHTML); }); Robert Walker wrote: > Hitesh Rawal wrote: >> Allen Walker wrote: >&

[Rails] Fire submit when drop down box item clicked

2009-02-15 Thread Allen Walker
This may not be rails specific, but i have a select drop down box and want the "submit" action fired when the user clicks one of the options in my drop down select tag box. How do I accomplish this? thanks -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--

[Rails] Re: remote_form_for not passing form values

2009-01-08 Thread Allen Walker
I solved it: Don't put your form tag under a tag. Argh. -- 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 ru

[Rails] remote_form_for not passing form values

2009-01-08 Thread Allen Walker
I have the following: <% form_remote_for :role, :method => :put, :url => {:controller => "roles", :action => "update", :id => @role.id\ } do |f| %> <%= select("role", "default_view", Account::ROLES) %> <%= submit_tag("Update"); %> <% end -%> Controller co

[Rails] AJAX select box dropdown update form

2008-12-29 Thread Allen Walker
I have the following form with 2 selectbox drop downs: SelectBox1 SelectBox2 WHen the user changes the selection in SelectBox1, I want SelectBox2 to be updated to contain a different set of options. I'm not sure exactly how to do this. If someone could point me in the right direction, I'd appre

[Rails] Re: link_to and routing question

2008-12-15 Thread Allen Walker
Patrick Doyle wrote: > On Sun, Dec 14, 2008 at 10:27 PM, Allen Walker < > rails-mailing-l...@andreas-s.net> wrote: > >> >> {:action=>"wsdl"} /:controller/:action/:id.:format >> /:controller/:action/:id >> >> So it's

[Rails] link_to and routing question

2008-12-14 Thread Allen Walker
I have the following link_to: <%= link_to("Remove", {:action => "remove_role_from_account", :role_id => role, :account_id => @account}) %> It generates: http://myserver.com/roles/remove_role_from_account?account_id=1&role_id=5 But this doesn't match the right default route: {:action=>"wsdl"} /

[Rails] many to many and delete question

2008-12-14 Thread Allen Walker
I have a "has_and_belongs_to_many" relationship between two tables, meaning I have a join table that contains the two ids of each table. For simplicity let's call them "foo" and "bar". I want to delete a bar from a foo but not actually delete the bar itself. foo = Foo.find(1) bar = Bar.find(1)

[Rails] ActiveRecord in memory only object for wizard?

2008-11-03 Thread Allen Walker
I have a wizard with multiple screens where I essentially populate an ActiveRecord object. However I DO NOT want to save it to the database until the last screen and the user clicks save. Meanwhile though, I want to get access to the object at anytime via the wizard. So should I simply create the

[Rails] Re: file upload Routing problem

2008-11-03 Thread Allen Walker
Still having issues. Funny this is if I deploy on a different host uploading works fine. -- 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 pos

[Rails] file upload Routing problem

2008-10-30 Thread Allen Walker
I have the following upload form: <% form_for @product_datum, :url => { :action => :create }, :html => { :multipart => true } do |form| %> ... <%= form.file_field :uploaded_data%> <%= form.submit "Upload" %> In my controller I have a def create .. end For some reason when the user clicks s

[Rails] observe_field producing nothing on view

2008-10-24 Thread Allen Walker
I had this working fine before, but now for some reason <%= observe_field( :sale_sku_id, :url => {:action => "update_sales_form"}, :update => :unit_price, :with => :sku_id) %> Produces nothing on the view side. I have <%= javascript_include_tag :defaults %> at the top of my layouts/applicatio

[Rails] Re: observe_field

2008-10-21 Thread Allen Walker
Mark Reginald James wrote: > Allen Walker wrote: >> Ok this worked: >> >> <%= javascript_tag >> "document.getElementById('guarantee_status').onchange()" %> > > That suggests your problem was absence of the Prototype > library, mea

[Rails] Re: observe_field

2008-10-20 Thread Allen Walker
Ok this worked: <%= javascript_tag "document.getElementById('guarantee_status').onchange()" %> Allen Walker wrote: > Even if I do: > > <%= javascript_tag "alert('Hello')" %> > > Nothing happens. So it doesn't seem to

[Rails] Re: observe_field

2008-10-20 Thread Allen Walker
Even if I do: <%= javascript_tag "alert('Hello')" %> Nothing happens. So it doesn't seem to be executing this javascript after the dom loads in the brower (so I still can't set the initial state) Mark Reginald James wrote: > Allen Walker wrote: &g

[Rails] Re: observe_field

2008-10-20 Thread Allen Walker
Mark Reginald James wrote: > Allen Walker wrote: >> No such luck again. Here's the generated HTML: > > Looking at the Prototype code, observe only calls > the function if the value has actually changed. > > So one way would be to move the observer inline: > >

[Rails] Re: observe_field

2008-10-20 Thread Allen Walker
window.attachEvent("onload", olf); //]]> Mark Reginald James wrote: > Allen Walker wrote: >> Doesn't work. I tried putting the javascript_tag right after the div and >> outside the form itself. I understand the logic in the code but for some >

[Rails] Re: observe_field

2008-10-20 Thread Allen Walker
is not getting called. Mark Reginald James wrote: > Allen Walker wrote: >> >> page[:balance_div].hide >> else >> page[:balance_div].show >> end >> end >> end >> end > > One way is to add the f

[Rails] observe_field

2008-10-20 Thread Allen Walker
I have the following in my view: <%= observe_field 'guarantee_status', :url => {:controller => 'testcontroller', :action => 'change_status'}, :with => 'value' %> Remaining Balance <%= f.text_field :balance %> No when I first load this page, I need the change_status method hit on

[Rails] Re: updating attribute in model

2008-10-08 Thread Allen Walker
Philip Hallstrom wrote: >> end >> >> I'm getting a "stack level too deep error". Any suggestions on how to >> fix and the correct approach to this. > > You're calling status from within status so it's recursing forever. > > Replace that last status with read_attribute(:status) after perhaps > re

[Rails] updating attribute in model

2008-10-08 Thread Allen Walker
I'm trying to make a change to a field in the model whenever someone accesses it and it's incorrect. So I have the following in my ActiveRecord class: def status prev_status = read_attribute(:status) if end_date < Date.today update_attribute(:status, "Expired") end status end I'm get

[Rails] Re: observe_form question

2008-10-01 Thread Allen Walker
Ok I got it to work doing: render :update do |page| page << "$('sale_unit_price').value = 100;" end -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"

[Rails] Re: observe_form question

2008-10-01 Thread Allen Walker
In my controller I tried: render :text => "$('sale_unit_price').value = 100" no such luck Allen Walker wrote: > Ok .. so how exactly should I code this in my controller method? Also > you are suggesting I should not have the :update option at all in my > o

[Rails] Re: observe_form question

2008-10-01 Thread Allen Walker
Ok .. so how exactly should I code this in my controller method? Also you are suggesting I should not have the :update option at all in my observe_form call? Frederick Cheung wrote: > On Oct 1, 8:08�am, Allen Walker <[EMAIL PROTECTED]> > wrote: >> Well I've tried both

[Rails] Re: observe_form question

2008-10-01 Thread Allen Walker
Well I've tried both and it doesn't work. My generated html source for the form: Mikel Lindsaar wrote: > On Wed, Oct 1, 2008 at 2:29 PM, Allen Walker > <[EMAIL PROTECTED]> wrote: >> <%= observe_form( :sales_form, :url => {:action => "update_sa

[Rails] observe_form question

2008-09-30 Thread Allen Walker
Ok in my view.rhtml: <% form_for :sale, :url => {:action => 'add_sale', :id => @report}, :html => {:id => 'sales_form'} do |f| %> ... <%= f.text_field :unit_price, :size => 10 %> ... <% end %> <%= observe_form( :sales_form, :url => {:action => "update_sales_form"}, :update => :sale_unit_price) %