[Rails] Re: Using update_attributes(params[:something]) w/ manual assignment

2010-05-27 Thread Frederick Cheung


On May 27, 10:55 pm, Jose Ambros-ingerson 
wrote:
> Perry Smith wrote:
>
> > By the way, update_attributes calls save (as of 2.3.2? or was it before
> > that) only if at least one attribute has changed.
>
> It appears to me that this is not true. I tried it below using 2.3.5.
> As you can see the 'locale' attribute was "es" and it got updated to
> "es" anyway. Did I get this wrong?

Actually that bit in the logs show the name getting set to spanish as
well. It's also possible that you've turned off this behaviour -
ActiveRecord::Base.partial_updates (or something along those lines)
controls whether this is enabled if my memory is correct

Fred

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] NoMethodError: You have a nil object when you didn't expect

2010-05-27 Thread Mathew Augustine
da manu.this prob is  related   with routes.yor  are  suppose to put that
method in routes.rb

On Thu, May 27, 2010 at 5:13 PM, Manivannanj Jeganathan <
li...@ruby-forum.com> wrote:

> Hi,
>
>  I have tried to use searchlogic in my application...
> in def index,
>  @search = AccounDetail.search(params[:search])
>  @account_details = @search.all
>
> In index.rhtml
> <%form_for @search do |f|%>
>  
><%=f.label :name_like,"Name"%>
><%=f.text_field :name_like%>
><%=submit_tag :Search,:name=>nil%>
>  
> <%end%>
>
> I didn't get any search result...
> i tried it with ruby script/console.
> when i call @search.all, i got "NoMethodError: You have a nil object
> when you didn't expect"
>
>
> example
>
> >>search=AccountDetail.search(:name_like_any=>"xx")
> >>search.all
>
> give me a suggestion to solve this problem
> --
> 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
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
-- 
Thanks & Regards,

  Mathew Augustine
  Software Programmer(ROR)
  Maxxion Technologies Inc
  Kakkanad - Cochin
  Mob:+91 -9846476386
  Email(y) :mathew...@yahoo.co.in
  Email(G):itzmemu...@gmail.com
  Blog:http://electronicstrainer.blogspot.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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails 3 Error:uninitialized constant ActiveResource::Base

2010-05-27 Thread DmitryPush
Thx!

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: HTML character codes in ActionMailer subject

2010-05-27 Thread jhaagmans
> > We have our e-mail subjects stored in I18n locale files. For the
> > English version of the website, we had no problem, but now we're
> > translating to German, which uses a lot of symbols like ü and
> > Ü for example. We store them as character codes in the YAML
> > files,
>
> Why?  That's a really bad idea.

Because the subject lines are used in our website as well. xHTML
strict needs our "strange" characters to be character codes.

>
> > but most e-mail clients won't parse HTML-code in the subjects.
> > Is it fine to just use the actual characters in the YAML files?
>
> Yes.
>
> > Will
> > that work on any system?
>
> Yes, provided you specify the correct encoding (I recommend UTF-8 for
> everything).

Thanks. Is there a way to convert these HTML character codes to the
actual characters?

Jaap

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: add textbox dymamically

2010-05-27 Thread Ravi Dtv
chewmanfoo wrote:
> http://railscasts.com/episodes/75-complex-forms-part-3
> 
> that might help

Thanks chewmanfoo, this is what the functionality Im looking for.

Thanks all for replying.
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Rails and JSON example?

2010-05-27 Thread Ralph Shnelvar
Does anyone know of a demo or tutorial in which ...



(1) In a browser some data is packaged up using JSON.
(2) an async request is sent to a rails app sending the JSON data.  I
would like this to be done via jQuery.

(3) A rails app deserializes the JSON data.
(4) The Rails app then packages up some other data using JSON, again
(5) The Rails app sends this data back to the browser.

(6) jQuery code then deserializes the returned data.
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Why was overwrite_params deprecated in Rails 3?

2010-05-27 Thread Ryan Michael
As far as I can tell there's no 'preferred' way to do this instead of
using overwrite_params and this is extrememly usefuly in situations
where it's hard to know exactly which parameters will be set in a view
(for instance filtering a few of multiple options using query string
params).

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails 3 telling me route doesn't exist

2010-05-27 Thread Adam Leonard
genki...@gmail.com wrote:
> Dude, it's new_category_subcategory_path(@category), you missed a
> "_path"

Yeah I found out today, I feel really stupid :/
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails 3 telling me route doesn't exist

2010-05-27 Thread genki...@gmail.com
Dude, it's new_category_subcategory_path(@category), you missed a
"_path"

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] UTF8 name not carried into the page cache filename

2010-05-27 Thread dave4...@greatchiro.com
I am using ruby 1.8.7 and rail 3 beta3 on Windows XP.

Page caching works okay and the content of the cache is UTF8 as
expected.  However, the filename which came from the UTF8 URL is not
okay.

Apache can not find the file because it is not filed as a UTF8
filename but something else.

I do not know whether this is a Rails 3 bug or something I did wrong.
Can anybody help?

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: before_filter always running in test, not in development or production mode.

2010-05-27 Thread John Postlethwait
I found a way around this, though I still have no clue why this works:

In my controller, if I add:

def show
end

The before filter DOES NOT run, as I expect, as soon as I remove the
def show;end the filter is once again applied to the #show action. Is
this a Rails3 bug?

-John

On May 27, 3:27 pm, John Postlethwait 
wrote:
> This is apparently not related to Shoulda... This test also fails
> using Test::Unit by itself:
>
>   test 'A guest on GET to #show' do
>     get :show, { :id => users(:alexander).id }
>
>     assert flash.empty?
>     assert_not_nil assigns(:user)
>     assert_response :success
>   end
>
> Failure:
>  1) Failure:
>   test_A_guest_on_GET_to_#show(UsersControllerTest) [test/functional/
> users_controller_test.rb:44]:
>    is not true.
>
> Line 44 is the flash being empty, it is, once again set to:
> {:error=>"Sorry! You need to log in before visiting that page."}
>
> Am I missing something obvious? Why is this filter always running? Is
> this related to Rails3?
>
> Thanks in advance.
>
> -John Postlethwait
>
> On May 27, 1:07 pm, John Postlethwait 
> wrote:
>
>
>
> > I'm using Shoulda and restful_authentication on Rails3 and whenever I
> > run my tests a before filter for login_required is always triggered,
> > despite my filter being set up as:
>
> >   before_filter :login_required, :only =>
> > [:update, :edit, :suspend, :unsuspend, :destroy, :purge]
>
> > My test is this:
>
> >   context 'A guest to the site' do
> >     context 'on GET to :show' do
> >       setup { get :show, { :id => users(:alexander).id } }
>
> >       should_not_set_the_flash
> >       should_assign_to :user
> >       should_respond_with :success
> >     end
> >   end
>
> > The test fails though:
>
> >   3) Failure:
> >   test: A guest to the site on GET to :show should assign @user.
> > (UsersControllerTest)
> >     []:
> >   Expected action to assign a value for @user
>
> >   4) Failure:
> >   test: A guest to the site on GET to :show should not set the flash.
> > (UsersControllerTest)
> >     []:
> >   Did not expect the flash to be set, but was {:error=>"Sorry! You
> > need to log in before visiting that page."}
>
> >   5) Failure:
> >   test: A guest to the site on GET to :show should respond with
> > success. (UsersControllerTest)
> >     []:
> >   Expected response to be a 200, but was 302
>
> > Here is the code for my before_filter that is actually making this
> > test fail:
>
> >   def login_required
> >     authorized? || access_denied
> >   end
>
> >   def access_denied
> >     session[:return_to] = request.fullpath
> >     flash[:error] = t('application.flash.error.login_required')
>
> >     redirect_to(new_sessions_path)
> >   end
>
> > This code, as far as my understanding goes, should NOT ever be called
> > from this test though... I have the :only => [] in the controller to
> > not do it on show. Can anyone lend any insight as to why it is being
> > triggered? Another strange thing is this DOES NOT happen in production
> > or development modes using the browser. I can be logged out and visit
> > this page just fine without this before_filter being called.

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using update_attributes(params[:something]) w/ manual assignment

2010-05-27 Thread Perry Smith
Jose Ambros-ingerson wrote:
> Jose Ambros-ingerson wrote:
>> Perry Smith wrote:
>> 
>>> 
>>> By the way, update_attributes calls save (as of 2.3.2? or was it before 
>>> that) only if at least one attribute has changed.
>> 
> 
> Though failure to behave this way (see above) is hurting me;
> I have an observer that get's triggered on the save, but if the save 
> didn't change anything (the record attributes are the same as before the 
> save) I would of preferred that the observer had not been triggered.
> 
> Is writing a custom update_attributes (that does a save only if it would 
> result in different attribute values) the way to go?
> 
> THanks in advance for your help, Jose

I suggest looking at 
http://railscasts.com/episodes/109-tracking-attribute-changes

It gives you an overview of how it is suppose to work.  It seems like 
you should be able to test the model to see if it thinks a particular 
value has been changed or not and hopefully figure out what is going on.
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Safebuffer with rails 2.3.8

2010-05-27 Thread Loïc Guitaut
It's with the javascript include in lib/fckeditor.rb. Just comment out all the 
"module ActionView::Helpers::AssetTagHelper" block and include fckeditor.js as 
you do with another JS file.
You'll get rid of those deprecation warnings :)

Le jeudi 27 mai 2010 20:05:06, Rafael Coelho de Souza a écrit :
> And what was the problem? I'm having the same issue.
> 
> Best,
> 
> Rafael
> 
> On Thu, May 27, 2010 at 9:33 AM, Loïc Guitaut  wrote:
> > Found it! It was a problem with fckeditor plugin.
> > 
> > Le mercredi 26 mai 2010 11:21:41, Loïc Guitaut a écrit :
> > > Hi there!
> > > 
> > > I've just migrated from rails 2.3.5 to 2.3.8 and now I have a lot (and
> > > I mean a lot!) of deprecation warnings like this one: "DEPRECATION
> > > WARNING: ActionView::SafeBuffer is deprecated! Use
> > > ActiveSupport::SafeBuffer instead."
> > > 
> > > But I don't understand how to remove this. I searched through installed
> > > plugins, and there is no reference to SafeBuffer :(
> > > 
> > > Any help would be appreciated please.
> > > 
> > > Thanks!
> > 
> > --
> > 
> >  ,= ,-_-. =.   Loïc Guitaut
> >  ((_/)o o(\_))  http://www.belfalas.org
> >  `-'(. .)`-'   Jabber ID : fl...@im.apinc.org
> >  
> >  \_/   GnuPG KeyID : 0xA78CD85D

-- 
  ,= ,-_-. =.   Loïc Guitaut
 ((_/)o o(\_))  http://www.belfalas.org
  `-'(. .)`-'   Jabber ID : fl...@im.apinc.org
  \_/   GnuPG KeyID : 0xA78CD85D


signature.asc
Description: This is a digitally signed message part.


[Rails] Re: Using update_attributes(params[:something]) w/ manual assignment

2010-05-27 Thread Jose Ambros-ingerson
Jose Ambros-ingerson wrote:
> Perry Smith wrote:
> 
>> 
>> By the way, update_attributes calls save (as of 2.3.2? or was it before 
>> that) only if at least one attribute has changed.
> 

Though failure to behave this way (see above) is hurting me;
I have an observer that get's triggered on the save, but if the save 
didn't change anything (the record attributes are the same as before the 
save) I would of preferred that the observer had not been triggered.

Is writing a custom update_attributes (that does a save only if it would 
result in different attribute values) the way to go?

THanks in advance for your help, Jose
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: before_filter always running in test, not in development or production mode.

2010-05-27 Thread John Postlethwait
This is apparently not related to Shoulda... This test also fails
using Test::Unit by itself:

  test 'A guest on GET to #show' do
get :show, { :id => users(:alexander).id }

assert flash.empty?
assert_not_nil assigns(:user)
assert_response :success
  end

Failure:
 1) Failure:
  test_A_guest_on_GET_to_#show(UsersControllerTest) [test/functional/
users_controller_test.rb:44]:
   is not true.

Line 44 is the flash being empty, it is, once again set to:
{:error=>"Sorry! You need to log in before visiting that page."}

Am I missing something obvious? Why is this filter always running? Is
this related to Rails3?

Thanks in advance.

-John Postlethwait

On May 27, 1:07 pm, John Postlethwait 
wrote:
> I'm using Shoulda and restful_authentication on Rails3 and whenever I
> run my tests a before filter for login_required is always triggered,
> despite my filter being set up as:
>
>   before_filter :login_required, :only =>
> [:update, :edit, :suspend, :unsuspend, :destroy, :purge]
>
> My test is this:
>
>   context 'A guest to the site' do
>     context 'on GET to :show' do
>       setup { get :show, { :id => users(:alexander).id } }
>
>       should_not_set_the_flash
>       should_assign_to :user
>       should_respond_with :success
>     end
>   end
>
> The test fails though:
>
>   3) Failure:
>   test: A guest to the site on GET to :show should assign @user.
> (UsersControllerTest)
>     []:
>   Expected action to assign a value for @user
>
>   4) Failure:
>   test: A guest to the site on GET to :show should not set the flash.
> (UsersControllerTest)
>     []:
>   Did not expect the flash to be set, but was {:error=>"Sorry! You
> need to log in before visiting that page."}
>
>   5) Failure:
>   test: A guest to the site on GET to :show should respond with
> success. (UsersControllerTest)
>     []:
>   Expected response to be a 200, but was 302
>
> Here is the code for my before_filter that is actually making this
> test fail:
>
>   def login_required
>     authorized? || access_denied
>   end
>
>   def access_denied
>     session[:return_to] = request.fullpath
>     flash[:error] = t('application.flash.error.login_required')
>
>     redirect_to(new_sessions_path)
>   end
>
> This code, as far as my understanding goes, should NOT ever be called
> from this test though... I have the :only => [] in the controller to
> not do it on show. Can anyone lend any insight as to why it is being
> triggered? Another strange thing is this DOES NOT happen in production
> or development modes using the browser. I can be logged out and visit
> this page just fine without this before_filter being called.

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Creating a report generator within a mysql database to b

2010-05-27 Thread Marnen Laibow-Koser
jraglin wrote:
> Hello,
> 
> My issue is that I am creating a database in MySQL and needing to
> export the information in automatically generated reports (.csv), into
> a web application written in Rails.

Well, you can generate the CSV files with MySQL's export feature and 
read them with FasterCSV.  But that seems silly: it would be better to 
have the Rails app connect to the DB directly and get the data it needs.

> 
> Does anyone have any advice or tutorial links as to how I may do this?
> Or whether Rails or MySQL have a preferably freeware application that
> could make it much easier?
> 
> Thanks

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org


-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Using update_attributes(params[:something]) w/ manual assignment

2010-05-27 Thread Jose Ambros-ingerson
Perry Smith wrote:

> 
> By the way, update_attributes calls save (as of 2.3.2? or was it before 
> that) only if at least one attribute has changed.

It appears to me that this is not true. I tried it below using 2.3.5.
As you can see the 'locale' attribute was "es" and it got updated to 
"es" anyway. Did I get this wrong?

>> Language.first
  Language Load (0.8ms)   SELECT * FROM `languages` LIMIT 1
++-++
| id | name| locale |
++-++
| 1  | Español | es |
++-++
1 row in set
>> Language.first.update_attributes({:locale=>"es"})
  Language Load (0.4ms)   SELECT * FROM `languages` LIMIT 1
  SQL (0.1ms)   BEGIN
  Language Update (0.3ms)   UPDATE `languages` SET `name` = 'spanish', 
`locale` = 'es' WHERE `id` = 1
  SQL (1.2ms)   COMMIT
=> true
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Creating a report generator within a mysql database to be read on rails.

2010-05-27 Thread jraglin
Hello,

My issue is that I am creating a database in MySQL and needing to
export the information in automatically generated reports (.csv), into
a web application written in Rails.

Does anyone have any advice or tutorial links as to how I may do this?
Or whether Rails or MySQL have a preferably freeware application that
could make it much easier?

Thanks

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: How to have *_url generate urls with https:// proto

2010-05-27 Thread Marnen Laibow-Koser
Errol Siegel wrote:
>> Use *_path?  I do it and haven't seen any browsers complain about the 
>> redirects...
> Again, that would mean going through the entire application and changing 
> every reference.
> 
> Besides, using relative paths in redirects violates the HTTP spec.  I 
> understand that it gets the job done, but that doesn't seem like the 
> right way to do it.
> 
> I don't wish to appear argumentative, but I really hope somebody knows a 
> cleaner way to do this.

Use default_url_options.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Ajax submit: Clicking 'Submit' vs. hitting ENTER

2010-05-27 Thread Frederick Cheung


On May 27, 6:24 pm, Tom Ha  wrote:
> Hi there,
>
> Has anyone an idea why the below form
> - submits correctly when I click the 'Submit' button
> - but does call the 'new' action instead of 'create' when I hit ENTER?
>
> <% form_remote_tag :html => { :action => url_for(:controller => 'pages',
>                                                  :action => 'create') }
> do -%>
>
>   <%= text_field :page, :title %>
>   <%= submit_to_remote 'blah', 'Submit', :url => {:controller =>
> 'pages',
>                                                   :action => 'create'}
> %>
>
> <% end -%>
>
Well it should be ok to have that submit tag just be a normal submit
tag. Secondly if my memory is correct, passing the html => :action
option is only for setting up a fallthrough for if the user doesn't
have javascript  (check what gets generated). You also need to say
something like form_remote_tag :url => {:controller => pages ...

Fred
> Thanks a lot for any hints!
> Tom
> --
> Posted viahttp://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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Ajax submit: Clicking 'Submit' vs. hitting ENTER

2010-05-27 Thread Hassan Schroeder
On Thu, May 27, 2010 at 1:03 PM, Colin Law  wrote:

> Assuming html is valid is it possible that Enter is hitting a
> different button or link on the page?  Does the log give any clues?

Besides the above, use FF/Firebug to

1) confirm there are no JavaScript errors occurring
2) compare the network traffic generated by each event

FWIW,
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: has_many :through association not working properly

2010-05-27 Thread chewmanfoo
Yes!  that's it!  thanks!

On May 27, 4:14 pm, Hassan Schroeder 
wrote:
> On Thu, May 27, 2010 at 10:41 AM, chewmanfoo  wrote:
> > ISSUE:
> > The host has 3 ip addresses on two networks (#62 is repeated)
> > How do I get host.networks to return only the two networks?
> > ## network_hosts model
> > class NetworkHost < ActiveRecord::Base
>
> >  has_many :ip_addresses, :dependent => :destroy
> >  has_many :networks, :through => :ip_addresses
>
> Wouldn't
>
>   has_many :networks, :through => :ip_addresses, :uniq => true
>
> do it?
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] has_many :through association not working properly

2010-05-27 Thread Hassan Schroeder
On Thu, May 27, 2010 at 10:41 AM, chewmanfoo  wrote:
> ISSUE:
> The host has 3 ip addresses on two networks (#62 is repeated)
> How do I get host.networks to return only the two networks?

> ## network_hosts model
> class NetworkHost < ActiveRecord::Base
>
>  has_many :ip_addresses, :dependent => :destroy
>  has_many :networks, :through => :ip_addresses

Wouldn't

  has_many :networks, :through => :ip_addresses, :uniq => true

do it?
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Validating with Encryption

2010-05-27 Thread Robert Walker
tashfeen.ekram wrote:
> hmmm. what you mention does make sense. perhaps i will roll my own.
> 
> however, i would like to completely understand. so, ideally the
> encryption should work such that all of the active record attributes
> work as expected. when retrieving an attribute you would get the
> expected object.
> 
> i dont have any experience to do such a thing. any references of of
> other gems doing anything remotely similar to this?

I don't know of any specific gems. I was just thinking conceptually as 
follows:

1. User enters, obviously, clear text into a form field.
2. User submits form over SSL to ensure encrypted transmission.
3. Rails stack processes data into the params hash.
4. Controller sends "save" message to ActiveRecord instance.
5. ActiveRecord/ActiveModel callback chain (e.g. before_validation, 
after_validation, before_save, after_save, etc.) all occur as normal.
6. Either inside or after validation, but before save, encryption 
occurs.

One possibility would be for a gem to add a couple of new callback hooks 
to the chain. Maybe something like before_encryption and 
after_encryption. But, that's probably not even necessary in this case.

If I were to implement something like this I would probably call my 
encryption routine from within after_validation. This should occur 
before the data actually gets saved to the database. If some problems 
occur during encryption then after_validation should return false having 
the effect of canceling the save. At that point "save" should also 
return false and you're controller should handle that in the normal way.

You would also need some way to decrypt the data after a "find" 
operation. I don't think that Rails has any built-in hooks for this, but 
I could be wrong about that. I used to use a ORM called Enterprise 
Objects (EOF) that supported such a mechanism though use of the delegate 
pattern. There was a delegate method "awakeFromFetch()" that 
EOEnterpriseObject subclasses could override to perform initialization 
after fetch. This provided a nice place to "hook in" to perform these 
kinds of things. But, I can't think of any such convenience in Rails, 
but that's not a "show-stopper."

P.S. Out of curiosity I looked at the stongbox gem. From a quick glance 
I don't think it would be something that would interest me. It uses 
public key technology, which I just don't see the benefit of using given 
it huge trade-off in performance. I really think a symmetric key system 
would make a lot more sense for most cases. I could certainly be missing 
some important point, however.
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: collection.last does not seem to jive with collection.count after collection.build

2010-05-27 Thread Dee
Thanks, Jeff.

Thanks for the clarification of the difference between .size
and .count. I was actually looking more for something that does .last
like .count, rather than .count like .last. I got around that by doing
and :order_by => 'created_at' before using .last, which puts the nils
at the head, at least in MySQL and SQLite.

Big thanks for clone. It's brilliant. I didn't know it existed. It was
beginning to look like a maintenance nightmare without it.

On May 27, 3:09 pm, Jeff  wrote:
> On May 27, 11:47 am, Dee  wrote:
>
> > I was just trying to write a "smart" copy method in a class* and
> > noticed that the last and count collection methods don't work the same
> > after build and before save. In other words, if in my code I do this:
>
> >     user = User.new
> >     user.save
> >     purchase = user.purchases.build
>
> > Then I get the following:
> >     user.purchases.count => 0
> >     user.purchases.last => #
>
> That's because .count is using SQL to look at the table, but you
> haven't committed the new purchase to the db yet.  .last knows to use
> the in-memory collection instead.
>
> Instead of .count, use .size, which is aware of in-memory changes.
>
> That said, consider using .clone, which will copy an object for you
> that you can start with.
>
> Jeff
> purpleworkshops.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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Validating with Encryption

2010-05-27 Thread tashfeen.ekram
hmmm. what you mention does make sense. perhaps i will roll my own.

however, i would like to completely understand. so, ideally the
encryption should work such that all of the active record attributes
work as expected. when retrieving an attribute you would get the
expected object.

i dont have any experience to do such a thing. any references of of
other gems doing anything remotely similar to this?

On May 27, 3:22 pm, Robert Walker  wrote:
> tashfeen.ekram wrote:
> > hmmm ok. i was using strongbox gem. what you recommends seems like
> > it would work if i wrote my own encryption. i think the encryption in
> > the gem is carried out prior to validation. is there another way in
> > which i can still use strongbox?
>
> I've not looked at the strongbox gem, but if that's the case I would
> avoid using that gem. If you're going to have a gem do your
> encrypting/decrypting it should be transparent to the application layer
> IMHO. This would mean hooking itself in right above the database adaptor
> layer so that all the higher level ActiveRecord/ActiveModel stuff just
> works as normal.
>
> Maybe you should find a better gem, or roll your own. Encryption isn't
> exactly rocket science to implement these days (maybe their
> implementations are akin to rocket science, but modern abstractions
> aren't).
> --
> Posted viahttp://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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Validating and using Kernal.System

2010-05-27 Thread anon_comp


On May 27, 3:53 pm, Colin Law  wrote:
> On 27 May 2010 18:32, anon_comp  wrote:
>
>
>
>
>
>
>
> > On May 27, 1:27 pm, anon_comp  wrote:
>
> >> > So what exactly is the problem then?  First look in the log file
> >> > (log/development.log) and see if the parameter is being passed
> >> > correctly when they submit.  If this is ok what do you want to do with
> >> > his input?
>
> >> The parameters are being passed correctly. What I want to do is pass
> >> the parameters to the command (added on to another command already in
> >> it) despite the security issues already pointed out.
>
> > That being said, I figured the issue out easly -headdesk-
>
> > (for people who may or may not need it in the future and for
> > documenting purposes...)
> > trying_controller.rb
> > 
> > class TryingController < ApplicationController
> >  def index
> >  end
>
> >  def to
> >   �...@logfile = params[:logfile]
> >    system('your_execute_file.exe', @logfile)
> >  end
> > end
>
> > Now I need to figure out how to validate the file so that it can't be
> > empty and it can't be any other format excpet with a .log as the
> > extension.
>
> Just do the checks on @logfile after you pick it up from params.  I
> would suggest checking for nil first then a regular expression test to
> check the format.  Google for ruby regular expression will give you
> loads of clues.
>
> Colin- Hide quoted text -
>
> - Show quoted text -


Good idea! I'm making a lot of headway.

Thanks,
anon_comp

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] before_filter always running in test, not in development or production mode.

2010-05-27 Thread John Postlethwait
I'm using Shoulda and restful_authentication on Rails3 and whenever I
run my tests a before filter for login_required is always triggered,
despite my filter being set up as:

  before_filter :login_required, :only =>
[:update, :edit, :suspend, :unsuspend, :destroy, :purge]

My test is this:

  context 'A guest to the site' do
context 'on GET to :show' do
  setup { get :show, { :id => users(:alexander).id } }

  should_not_set_the_flash
  should_assign_to :user
  should_respond_with :success
end
  end

The test fails though:

  3) Failure:
  test: A guest to the site on GET to :show should assign @user.
(UsersControllerTest)
[]:
  Expected action to assign a value for @user

  4) Failure:
  test: A guest to the site on GET to :show should not set the flash.
(UsersControllerTest)
[]:
  Did not expect the flash to be set, but was {:error=>"Sorry! You
need to log in before visiting that page."}

  5) Failure:
  test: A guest to the site on GET to :show should respond with
success. (UsersControllerTest)
[]:
  Expected response to be a 200, but was 302

Here is the code for my before_filter that is actually making this
test fail:

  def login_required
authorized? || access_denied
  end

  def access_denied
session[:return_to] = request.fullpath
flash[:error] = t('application.flash.error.login_required')

redirect_to(new_sessions_path)
  end

This code, as far as my understanding goes, should NOT ever be called
from this test though... I have the :only => [] in the controller to
not do it on show. Can anyone lend any insight as to why it is being
triggered? Another strange thing is this DOES NOT happen in production
or development modes using the browser. I can be logged out and visit
this page just fine without this before_filter being called.

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Ajax submit: Clicking 'Submit' vs. hitting ENTER

2010-05-27 Thread Colin Law
On 27 May 2010 18:24, Tom Ha  wrote:
> Hi there,
>
> Has anyone an idea why the below form
> - submits correctly when I click the 'Submit' button
> - but does call the 'new' action instead of 'create' when I hit ENTER?
>
>
> <% form_remote_tag :html => { :action => url_for(:controller => 'pages',
>                                                 :action => 'create') }
> do -%>
>
>  <%= text_field :page, :title %>
>  <%= submit_to_remote 'blah', 'Submit', :url => {:controller =>
> 'pages',
>                                                  :action => 'create'}
> %>
>
> <% end -%>


Firstly it may be worth checking the html of the page is valid (view
the source in your browser and copy and paste the complete html into
the w3c html validator - find it with google if necessary).

Assuming html is valid is it possible that Enter is hitting a
different button or link on the page?  Does the log give any clues?
I seem to remember a discussion here about this a little time ago, but
I don't remember the result.  A bit of searching here and googling may
be useful.

Colin

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Validating and using Kernal.System

2010-05-27 Thread Colin Law
On 27 May 2010 18:32, anon_comp  wrote:
>
>
> On May 27, 1:27 pm, anon_comp  wrote:
>
>> > So what exactly is the problem then?  First look in the log file
>> > (log/development.log) and see if the parameter is being passed
>> > correctly when they submit.  If this is ok what do you want to do with
>> > his input?
>>
>> The parameters are being passed correctly. What I want to do is pass
>> the parameters to the command (added on to another command already in
>> it) despite the security issues already pointed out.
>
> That being said, I figured the issue out easly -headdesk-
>
> (for people who may or may not need it in the future and for
> documenting purposes...)
> trying_controller.rb
> 
> class TryingController < ApplicationController
>  def index
>  end
>
>  def to
>   �...@logfile = params[:logfile]
>    system('your_execute_file.exe', @logfile)
>  end
> end
>
> Now I need to figure out how to validate the file so that it can't be
> empty and it can't be any other format excpet with a .log as the
> extension.

Just do the checks on @logfile after you pick it up from params.  I
would suggest checking for nil first then a regular expression test to
check the format.  Google for ruby regular expression will give you
loads of clues.

Colin

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Validating with Encryption

2010-05-27 Thread Robert Walker
tashfeen.ekram wrote:
> hmmm ok. i was using strongbox gem. what you recommends seems like
> it would work if i wrote my own encryption. i think the encryption in
> the gem is carried out prior to validation. is there another way in
> which i can still use strongbox?

I've not looked at the strongbox gem, but if that's the case I would 
avoid using that gem. If you're going to have a gem do your 
encrypting/decrypting it should be transparent to the application layer 
IMHO. This would mean hooking itself in right above the database adaptor 
layer so that all the higher level ActiveRecord/ActiveModel stuff just 
works as normal.

Maybe you should find a better gem, or roll your own. Encryption isn't 
exactly rocket science to implement these days (maybe their 
implementations are akin to rocket science, but modern abstractions 
aren't).
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: collection.last does not seem to jive with collection.count after collection.build

2010-05-27 Thread Jeff
On May 27, 11:47 am, Dee  wrote:
> I was just trying to write a "smart" copy method in a class* and
> noticed that the last and count collection methods don't work the same
> after build and before save. In other words, if in my code I do this:
>
>     user = User.new
>     user.save
>     purchase = user.purchases.build
>
> Then I get the following:
>     user.purchases.count => 0
>     user.purchases.last => #
>

That's because .count is using SQL to look at the table, but you
haven't committed the new purchase to the db yet.  .last knows to use
the in-memory collection instead.

Instead of .count, use .size, which is aware of in-memory changes.

That said, consider using .clone, which will copy an object for you
that you can start with.

Jeff
purpleworkshops.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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: [JOBS] Ruby help needed for misc. issues

2010-05-27 Thread AdamPHX
Kanaav:

Thanks for the response. What are your rates, and how much time would
it take to do this? Also, is there any warranty on the work for bugs
fixes, etc., if needed?

Adam

On May 26, 10:03 pm, kannav rajeev  wrote:
> *I can surely do these
> *- Resolving any IE 8 compatibility issues,
> - Add a Site Map.
> *I can suggest on these
> *- Adding subdomain links to our navbar,
> - Uploading KML files to our map as a new layer,
> - A permalink plugin to make sure our post URLs are SEO optimized,
>
>
>
> On Thu, May 27, 2010 at 9:26 AM, AdamPHX  wrote:
> > To the Ruby community:
>
> > We are a funded startup that wants to add the following features to
> > our existing Rails project:
>
> > - A permalink plugin to make sure our post URLs are SEO optimized,
> > - Resolving any IE 8 compatibility issues,
> > - Adding subdomain links to our navbar,
> > - Uploading KML files to our map as a new layer,
> > - Add a Site Map.
>
> > Our entire code base is on Github and it can be bootstrapped with a
> > rake task. If you're interested in helping us and our user community,
> > we look forward to hearing from you. Thanks!
>
> > --
> > 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
> > rubyonrails-talk+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> Thanks:
> Rajeev sharma

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Can I get meaningful page links using will_paginate?

2010-05-27 Thread Ron Phillips
Well, I still think it's silly to make users play "guess the page 
number," so here's how you can make nicely labeled page links with 
Paginator.

In your controller:

http://pastie.org/980498

and in your view:

http://pastie.org/980519


Perhaps this isn't so easy using will_paginate. So, another question: Is 
there any disadvantage to using Paginator?

Ron
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Accessing session data from a background worker

2010-05-27 Thread Jeff Lewis
Not sure what you are attempting to accomplish in those background
threads/processes, or what the reasoning is behind even using multiple
background threads/processes in the first place in light of what you
seem to be trying to do, but the basic strategy you're attempting to
pursue where you have multiple concurrent threads/processes all
reading from and writing back to some user's session data is just
asking for trouble on a number of levels: overwriting of data by one
of the background threads/processes or the user; resource contention
and deadlock; .

Even if you didn't use the user's session data to work with / store
such data, if you really want/need to pursue this multi-thread/-
process strategy for processing some common data, then you better
design that processing to deal for concurrency issues, which is not a
simple task.

Other alternatives include bailing entirely on the background threads/
processes and just perform the data processing sequentially and reset
the final val(s?) in the user's session once processing is completed,
or you could pass off such sequential processing to be done in some
background process that performs that data processing sequentially in
that background process and persists the final results somewhere else
to be picked up later on and made available to the user in some future
request.

Jeff

On May 26, 1:35 pm, PierreW  wrote:
> Fred and Jeff: thanks a lot I got it to "work".
>
> Thing is… I ran some tests and concurrency is in fact a big problem:
> my background workers all need to read and write from/to the session
> data. I was thinking that using a lock would help (each process would
> have to wait for the other to release the data):
>
> ActiveRecord::SessionStore::Session.find(:all, :conditions =>
> ["session_id = ?", lsession_id], :lock => true)
>
> but I am in fact getting an ActiveRecord::ConnectionTimeoutError (and
> yet I am trying to release the session as quickly as possible in each
> process).
>
> So I was wondering: is there a recommended design to get several
> workers to pass info between each other? Say for example:
>
> - a bunch of workers A do a simple task
> - a daemon worker B is "listening"
> - each time a process A returns a value, it "sends" it to B
> - B accumulates these values
>
> I thought that Workling return store would do the trick but it
> doesn't: each time you "set" a value it erases the previous one. I
> guess each A could store their return value as a row in a DB - but it
> seems to me like an overkill?
>
> For some reason I struggle to find info on this on the web.
>
> Thanks a lot,
> Pierre

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] [JOBS] SCEA San Diego

2010-05-27 Thread Emanuele MEK Tozzato
Are you interested in a Ruby on Rails position at Sony Computer
Entertainment America LLC? Working here is really great, I promise!

Position Overview:
Support PlayStation Online Games by developing and supporting in
production a high complexity, service oriented application that offers
online functionality for PS3, PSP, and PS2 games. The application
handles online features such as player login, stats, matchmaking,
community features, and chat. It is written in Ruby on Rails and makes
use of leading-edge technologies such as Redis and Resque.

This position is responsible for working directly with the game teams
to implement online functionality in their titles, using our Rails-
based framework. Success will require in-depth knowledge of Ruby on
Rails, MySQL, XML/JSON, REST, XHTML, CSS, and Linux system concepts.
Familiarity with Sinatra, Redis, Memcache, and NoSQL alternatives also
desired. This position will involve developing features in the Ruby on
Rails framework, as well as deploying them to the Amazon Web Services
(EC2/S3) platform.

/E
Senior Online Developer @ SCEA SD

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: How to have *_url generate urls with https:// protocol

2010-05-27 Thread Errol Siegel
> Use *_path?  I do it and haven't seen any browsers complain about the 
> redirects...
Again, that would mean going through the entire application and changing 
every reference.

Besides, using relative paths in redirects violates the HTTP spec.  I 
understand that it gets the job done, but that doesn't seem like the 
right way to do it.

I don't wish to appear argumentative, but I really hope somebody knows a 
cleaner way to do this.
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Safebuffer with rails 2.3.8

2010-05-27 Thread Rafael Coelho de Souza
And what was the problem? I'm having the same issue.

Best,

Rafael


On Thu, May 27, 2010 at 9:33 AM, Loïc Guitaut  wrote:

> Found it! It was a problem with fckeditor plugin.
>
> Le mercredi 26 mai 2010 11:21:41, Loïc Guitaut a écrit :
> > Hi there!
> >
> > I've just migrated from rails 2.3.5 to 2.3.8 and now I have a lot (and I
> > mean a lot!) of deprecation warnings like this one: "DEPRECATION WARNING:
> > ActionView::SafeBuffer is deprecated! Use ActiveSupport::SafeBuffer
> > instead."
> >
> > But I don't understand how to remove this. I searched through installed
> > plugins, and there is no reference to SafeBuffer :(
> >
> > Any help would be appreciated please.
> >
> > Thanks!
>
> --
>  ,= ,-_-. =.   Loïc Guitaut
>  ((_/)o o(\_))  http://www.belfalas.org
>  `-'(. .)`-'   Jabber ID : fl...@im.apinc.org
>  \_/   GnuPG KeyID : 0xA78CD85D
>



-- 
Rafael Strecker Coelho de Souza
http://www.cnxs.com.br

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: add textbox dymamically

2010-05-27 Thread chewmanfoo
http://railscasts.com/episodes/75-complex-forms-part-3

that might help

On May 27, 10:04 am, Ravi Dtv  wrote:
> Hii
>
> I need to add textbox dynamically when I click "Add" button.
>
> On clicking on button the textboxes are to be displayed one below the
> other.
>
> I enter different text in different textboxes, when clicked submit
> button all the content in all the textboxes should be saved.
>
> How can I achive this functionality?
>
> Please help. Thank you.
> --
> Posted viahttp://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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] has_many :through association not working properly

2010-05-27 Thread chewmanfoo
ISSUE:
The host has 3 ip addresses on two networks (#62 is repeated)
How do I get host.networks to return only the two networks?

>> host
=> #
>> host.ip_addresses.size
=> 3
>> host.networks
=> [#,
#,
#]
>> host.networks.size
=> 3

## networks model
class Network < ActiveRecord::Base
  has_many :ip_addresses, :dependent => :destroy
  has_many :network_hosts, :through => :ip_addresses

## network_hosts model
class NetworkHost < ActiveRecord::Base

  has_many :ip_addresses, :dependent => :destroy
  has_many :networks, :through => :ip_addresses

## ip_addresses model
class IpAddress < ActiveRecord::Base
 
attr_accessible :name, :ip, :logical_interface_name_id, :network_host_id, 
:network_id, :is_entry_point, :is_gateway, :mac

  belongs_to :network_host
  belongs_to :network

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: How to have *_url generate urls with https:// protocol

2010-05-27 Thread Philip Hallstrom
On May 27, 2010, at 10:11 AM, Errol Siegel wrote:

>> I assume you meant to say "http://"; ?
> 
> Yes!  I thought I proof-read so well...
> 
>>> How do I get *_url to generate a url with https:// for the protocol?
>> 
>> some_model_url(:scheme => 'https')
>> 
> Thanks for the response.  I guess I was looking for a way to do this 
> application-wide.  It would not be very DRY to have to add (:scheme => 
> 'https') to every place in my app where I call a *_url helper.
> 
> Is there another way?

Use *_path?  I do it and haven't seen any browsers complain about the 
redirects...

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Validating and using Kernal.System

2010-05-27 Thread anon_comp


On May 27, 1:27 pm, anon_comp  wrote:

> > So what exactly is the problem then?  First look in the log file
> > (log/development.log) and see if the parameter is being passed
> > correctly when they submit.  If this is ok what do you want to do with
> > his input?
>
> The parameters are being passed correctly. What I want to do is pass
> the parameters to the command (added on to another command already in
> it) despite the security issues already pointed out.

That being said, I figured the issue out easly -headdesk-

(for people who may or may not need it in the future and for
documenting purposes...)
trying_controller.rb

class TryingController < ApplicationController
  def index
  end

  def to
@logfile = params[:logfile]
system('your_execute_file.exe', @logfile)
  end
end

Now I need to figure out how to validate the file so that it can't be
empty and it can't be any other format excpet with a .log as the
extension.


>
>
> > > On May 27, 12:06 pm, Colin Law  wrote:
> > >> On 27 May 2010 15:43, anon_comp  wrote:
>
> > >> > Ok so I have a RoR project that seems to be...unconventional lol
>
> > >> > I'm attempting to validate the name of the file and using
> > >> > Kernal.System to input the file in the system as a parameter.
>
> > >> > I've tried validates_presence_of, but that doesn't appear to work
> > >> > unless in a model which I don't have. I'm trying to use
> > >> > error_messages_for, but I don't understand how to use it or what to
> > >> > put in the controller.
>
> > >> > As for the Kernal. System, how do you use it so that when the user
> > >> > hits "OK", RoR inputs the file in the correct command, runs it, and
> > >> > points the user to the generated html file?
>
> > >> > Here's the complete code:
>
> > >> > trying_controller.rb
> > >> > ---
> > >> > class TryingController < ApplicationController
> > >> >  def index
> > >> >  end
>
> > >> >  def to
> > >> >   �...@logfile = params[:logfile]
> > >> >  end
>
> > >> > end
>
> > >> > index.html.erb
> > >> > -
> > >> > <% form_tag :action => 'to' do %>
> > >> >  <%= error_messages_for 'logfile' %>
> > >> >  <%= label_tag 'logfile_label', 'Logfile:' %>
> > >> >  <%= file_field_tag :logfile %>
> > >> >  <%= submit_tag "OK" %>
> > >> > <% end %>
>
> > >> > to.html.erb
> > >> > 
> > >> > Logfile: <%= @logfile %>
>
> > >> Have I got this right, you are attempting to allow a user in a browser
> > >> to enter the name of a system command which will then be run on the
> > >> server?  If so I hope you realise that is incredibly dangerous.  I am
> > >> intrigued to know why you wish to allow this.
>
> > >> Colin- Hide quoted text -
>
> > >> - Show quoted text -
>
> > > --
> > > 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 
> > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/rubyonrails-talk?hl=en.-Hide quoted text 
> > > -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Handling custom error files (404/500) in Rails 3

2010-05-27 Thread anywho
I've been looking at rescue_from and rescue_action_in_public however,
none of them have worked without making a catch-all route.

So currently, my solution is to use the catch-all route:   match
'*path' => "controller#action" # custom 404  which then renders a 404
with the appropriate layout whether the user is logged in or not.
I've also set up a rescue_from to handle ActiveRecord::RecordNotFound
errors.

It feels like an unsatisfactory solution, and I'm not dealing with 500
errors at all. I would like to keep the informative errors that rails
gives during development, but simply have a choice to render a non-
static page in production.

Help appriciated.

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Validating and using Kernal.System

2010-05-27 Thread anon_comp
On May 27, 1:19 pm, Colin Law  wrote:

> Could you not top post please, it makes it easier to follow the thread
> if you insert your replies inline.

Sorry about that

> So what exactly is the problem then?  First look in the log file
> (log/development.log) and see if the parameter is being passed
> correctly when they submit.  If this is ok what do you want to do with
> his input?

The parameters are being passed correctly. What I want to do is pass
the parameters to the command (added on to another command already in
it) despite the security issues already pointed out.



>
> > On May 27, 12:06 pm, Colin Law  wrote:
> >> On 27 May 2010 15:43, anon_comp  wrote:
>
> >> > Ok so I have a RoR project that seems to be...unconventional lol
>
> >> > I'm attempting to validate the name of the file and using
> >> > Kernal.System to input the file in the system as a parameter.
>
> >> > I've tried validates_presence_of, but that doesn't appear to work
> >> > unless in a model which I don't have. I'm trying to use
> >> > error_messages_for, but I don't understand how to use it or what to
> >> > put in the controller.
>
> >> > As for the Kernal. System, how do you use it so that when the user
> >> > hits "OK", RoR inputs the file in the correct command, runs it, and
> >> > points the user to the generated html file?
>
> >> > Here's the complete code:
>
> >> > trying_controller.rb
> >> > ---
> >> > class TryingController < ApplicationController
> >> >  def index
> >> >  end
>
> >> >  def to
> >> >   �...@logfile = params[:logfile]
> >> >  end
>
> >> > end
>
> >> > index.html.erb
> >> > -
> >> > <% form_tag :action => 'to' do %>
> >> >  <%= error_messages_for 'logfile' %>
> >> >  <%= label_tag 'logfile_label', 'Logfile:' %>
> >> >  <%= file_field_tag :logfile %>
> >> >  <%= submit_tag "OK" %>
> >> > <% end %>
>
> >> > to.html.erb
> >> > 
> >> > Logfile: <%= @logfile %>
>
> >> Have I got this right, you are attempting to allow a user in a browser
> >> to enter the name of a system command which will then be run on the
> >> server?  If so I hope you realise that is incredibly dangerous.  I am
> >> intrigued to know why you wish to allow this.
>
> >> Colin- Hide quoted text -
>
> >> - Show quoted text -
>
> > --
> > 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 
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/rubyonrails-talk?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Ajax submit: Clicking 'Submit' vs. hitting ENTER

2010-05-27 Thread Tom Ha
Hi there,

Has anyone an idea why the below form
- submits correctly when I click the 'Submit' button
- but does call the 'new' action instead of 'create' when I hit ENTER?


<% form_remote_tag :html => { :action => url_for(:controller => 'pages',
 :action => 'create') }
do -%>

  <%= text_field :page, :title %>
  <%= submit_to_remote 'blah', 'Submit', :url => {:controller =>
'pages',
  :action => 'create'}
%>

<% end -%>


Thanks a lot for any hints!
Tom
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Validating and using Kernal.System

2010-05-27 Thread Colin Law
On 27 May 2010 18:07, anon_comp  wrote:
> In essence yes, but the user input is just an added command that won't
> do anything if they don't have a log file, or the rather, the correct
> log format. I'm mostly using this for personal use and am totally
> aware that it's incredibly dangerous. I just can't think of another
> way to do this.

Could you not top post please, it makes it easier to follow the thread
if you insert your replies inline.

So what exactly is the problem then?  First look in the log file
(log/development.log) and see if the parameter is being passed
correctly when they submit.  If this is ok what do you want to do with
his input?

Colin

>
> On May 27, 12:06 pm, Colin Law  wrote:
>> On 27 May 2010 15:43, anon_comp  wrote:
>>
>>
>>
>>
>>
>> > Ok so I have a RoR project that seems to be...unconventional lol
>>
>> > I'm attempting to validate the name of the file and using
>> > Kernal.System to input the file in the system as a parameter.
>>
>> > I've tried validates_presence_of, but that doesn't appear to work
>> > unless in a model which I don't have. I'm trying to use
>> > error_messages_for, but I don't understand how to use it or what to
>> > put in the controller.
>>
>> > As for the Kernal. System, how do you use it so that when the user
>> > hits "OK", RoR inputs the file in the correct command, runs it, and
>> > points the user to the generated html file?
>>
>> > Here's the complete code:
>>
>> > trying_controller.rb
>> > ---
>> > class TryingController < ApplicationController
>> >  def index
>> >  end
>>
>> >  def to
>> >   �...@logfile = params[:logfile]
>> >  end
>>
>> > end
>>
>> > index.html.erb
>> > -
>> > <% form_tag :action => 'to' do %>
>> >  <%= error_messages_for 'logfile' %>
>> >  <%= label_tag 'logfile_label', 'Logfile:' %>
>> >  <%= file_field_tag :logfile %>
>> >  <%= submit_tag "OK" %>
>> > <% end %>
>>
>> > to.html.erb
>> > 
>> > Logfile: <%= @logfile %>
>>
>> Have I got this right, you are attempting to allow a user in a browser
>> to enter the name of a system command which will then be run on the
>> server?  If so I hope you realise that is incredibly dangerous.  I am
>> intrigued to know why you wish to allow this.
>>
>> Colin- Hide quoted text -
>>
>> - Show quoted text -
>
> --
> 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 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: How to have *_url generate urls with https:// protocol

2010-05-27 Thread Errol Siegel
> I assume you meant to say "http://"; ?

Yes!  I thought I proof-read so well...

>> How do I get *_url to generate a url with https:// for the protocol?
> 
> some_model_url(:scheme => 'https')
> 
Thanks for the response.  I guess I was looking for a way to do this 
application-wide.  It would not be very DRY to have to add (:scheme => 
'https') to every place in my app where I call a *_url helper.

Is there another way?

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Validating and using Kernal.System

2010-05-27 Thread anon_comp
In essence yes, but the user input is just an added command that won't
do anything if they don't have a log file, or the rather, the correct
log format. I'm mostly using this for personal use and am totally
aware that it's incredibly dangerous. I just can't think of another
way to do this.

On May 27, 12:06 pm, Colin Law  wrote:
> On 27 May 2010 15:43, anon_comp  wrote:
>
>
>
>
>
> > Ok so I have a RoR project that seems to be...unconventional lol
>
> > I'm attempting to validate the name of the file and using
> > Kernal.System to input the file in the system as a parameter.
>
> > I've tried validates_presence_of, but that doesn't appear to work
> > unless in a model which I don't have. I'm trying to use
> > error_messages_for, but I don't understand how to use it or what to
> > put in the controller.
>
> > As for the Kernal. System, how do you use it so that when the user
> > hits "OK", RoR inputs the file in the correct command, runs it, and
> > points the user to the generated html file?
>
> > Here's the complete code:
>
> > trying_controller.rb
> > ---
> > class TryingController < ApplicationController
> >  def index
> >  end
>
> >  def to
> >   �...@logfile = params[:logfile]
> >  end
>
> > end
>
> > index.html.erb
> > -
> > <% form_tag :action => 'to' do %>
> >  <%= error_messages_for 'logfile' %>
> >  <%= label_tag 'logfile_label', 'Logfile:' %>
> >  <%= file_field_tag :logfile %>
> >  <%= submit_tag "OK" %>
> > <% end %>
>
> > to.html.erb
> > 
> > Logfile: <%= @logfile %>
>
> Have I got this right, you are attempting to allow a user in a browser
> to enter the name of a system command which will then be run on the
> server?  If so I hope you realise that is incredibly dangerous.  I am
> intrigued to know why you wish to allow this.
>
> Colin- Hide quoted text -
>
> - Show quoted text -

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Is using script/console in live production environment ok?

2010-05-27 Thread chris
If you are using SQLite make sure you run under same UID as passenger/
fastcgi/mongrel/etc

On May 27, 10:45 am, james  wrote:
> I need to make some minor record changes in the database on my live
> production site. I use Capistrano to deploy. I know I can activate
> script/console by entering my "/current" Capistrano directory and
> running:
>
> RAILS_ENV=production script/console
>
> Are there any dangers or pitfalls to be aware of when using script/
> console to make record changes to a live site in a production
> environment?

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] collection.last does not seem to jive with collection.count after collection.build

2010-05-27 Thread Dee
I was just trying to write a "smart" copy method in a class* and
noticed that the last and count collection methods don't work the same
after build and before save. In other words, if in my code I do this:

user = User.new
user.save
purchase = user.purchases.build

Then I get the following:
user.purchases.count => 0
user.purchases.last => #

It's never bothered me before now. As a human, I can ask the question
how can the count be 0 if the collection has a last element? I would
expect the last method to return nil in this case because I haven't
saved purchase yet.

I'm assuming the solution is to create my own "last" method, one that
filters out records with a nil value for created_at. Or another build
method that calls last before build. But both solutions seem un-DRY,
or worse un-DRRoR. But I thought maybe I am missing something.

*In case you're wondering, the method I'm writing copies certain
values of the last "purchase" model created by that user into a new
one, as a way of setting some default values. Maybe there is a more
rails-ee way of doing that too.

Thanks in advance.

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] add textbox dymamically

2010-05-27 Thread Hassan Schroeder
On Thu, May 27, 2010 at 9:35 AM, Colin Law  wrote:

> It is probably correct that the round trip to the server is pointless,
> but not necessarily, we do not know enough about the requirement.
> Maybe the text boxes to be added depend on data the user has entered
> and in data in the database in some way that would make AJAX more
> appropriate.

Of course that's possible, but if so certainly not apparent in the OP's
description of the task.

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] How to have *_url generate urls with https:// protocol

2010-05-27 Thread Philip Hallstrom
> Hello,
> 
> I accidentally posted this to the "Ruby" forum when it should have gone
> here -- sorry.
> 
> I am using *_path in views and *_url in controllers (with redirect_to,
> for example).  It is my understanding that this is generally considered
> a good practice.
> 
> I want to use my app using https, and thought it would work that way as
> long as I loaded the app by browsing to https://my.app.com.  However, it
> appears that even if I do this, redirect_to some_model_url generates a
> url with a protocol of https://.

I assume you meant to say "http://"; ?

> How do I get *_url to generate a url with https:// for the protocol?

some_model_url(:scheme => 'https')

-philip

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] add textbox dymamically

2010-05-27 Thread Colin Law
On 27 May 2010 17:20, Hassan Schroeder  wrote:
> On Thu, May 27, 2010 at 9:09 AM, Colin Law  wrote:
>
>>> A client-side action like this is done with JavaScript.
>
>> Or AJAX could be used.
>
> Which is still JavaScript, but with a pointless (in this case) round-trip
> to the server :-)

It is probably correct that the round trip to the server is pointless,
but not necessarily, we do not know enough about the requirement.
Maybe the text boxes to be added depend on data the user has entered
and in data in the database in some way that would make AJAX more
appropriate.

Colin

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: HTML character codes in ActionMailer subject

2010-05-27 Thread Marnen Laibow-Koser
Jaap Haagmans wrote:
> Hi,
> 
> We have our e-mail subjects stored in I18n locale files. For the
> English version of the website, we had no problem, but now we're
> translating to German, which uses a lot of symbols like ü and
> Ü for example. We store them as character codes in the YAML
> files,

Why?  That's a really bad idea.

> but most e-mail clients won't parse HTML-code in the subjects.
> Is it fine to just use the actual characters in the YAML files? 

Yes.

> Will
> that work on any system?

Yes, provided you specify the correct encoding (I recommend UTF-8 for 
everything).

> 
> Thanks in advance!

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Is using script/console in live production environment

2010-05-27 Thread Marnen Laibow-Koser
Andy Jeffries wrote:
> On 27 May 2010 15:45, james  wrote:
>> I need to make some minor record changes in the database on my live
>> production site. I use Capistrano to deploy. I know I can activate
>> script/console by entering my "/current" Capistrano directory and
>> running:
>>
>> RAILS_ENV=production script/console
>>
>> Are there any dangers or pitfalls to be aware of when using script/
>> console to make record changes to a live site in a production
>> environment?
> 
> No, it's fine - just obviously be careful of what you're doing.

And of course, if you need to do it more than once in a blue moon, 
something is obviously wrong.

> 
> Cheers,
> 
> 
> Andy

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] add textbox dymamically

2010-05-27 Thread Hassan Schroeder
On Thu, May 27, 2010 at 9:09 AM, Colin Law  wrote:

>> A client-side action like this is done with JavaScript.

> Or AJAX could be used.

Which is still JavaScript, but with a pointless (in this case) round-trip
to the server :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] add textbox dymamically

2010-05-27 Thread Colin Law
On 27 May 2010 16:35, Hassan Schroeder  wrote:
> On Thu, May 27, 2010 at 8:04 AM, Ravi Dtv  wrote:
>
>> I need to add textbox dynamically when I click "Add" button.
>
>> How can I achive this functionality?
>
> A client-side action like this is done with JavaScript.
>
> A JS library like Prototype or jQuery can be helpful, but you still have
> to write the code :-)

Or AJAX could be used.

Colin

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Validating and using Kernal.System

2010-05-27 Thread Colin Law
On 27 May 2010 15:43, anon_comp  wrote:
> Ok so I have a RoR project that seems to be...unconventional lol
>
> I'm attempting to validate the name of the file and using
> Kernal.System to input the file in the system as a parameter.
>
> I've tried validates_presence_of, but that doesn't appear to work
> unless in a model which I don't have. I'm trying to use
> error_messages_for, but I don't understand how to use it or what to
> put in the controller.
>
> As for the Kernal. System, how do you use it so that when the user
> hits "OK", RoR inputs the file in the correct command, runs it, and
> points the user to the generated html file?
>
> Here's the complete code:
>
> trying_controller.rb
> ---
> class TryingController < ApplicationController
>  def index
>  end
>
>  def to
>   �...@logfile = params[:logfile]
>  end
>
> end
>
>
>
> index.html.erb
> -
> <% form_tag :action => 'to' do %>
>  <%= error_messages_for 'logfile' %>
>  <%= label_tag 'logfile_label', 'Logfile:' %>
>  <%= file_field_tag :logfile %>
>  <%= submit_tag "OK" %>
> <% end %>
>
>
>
> to.html.erb
> 
> Logfile: <%= @logfile %>

Have I got this right, you are attempting to allow a user in a browser
to enter the name of a system command which will then be run on the
server?  If so I hope you realise that is incredibly dangerous.  I am
intrigued to know why you wish to allow this.

Colin

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] add textbox dymamically

2010-05-27 Thread Hassan Schroeder
On Thu, May 27, 2010 at 8:04 AM, Ravi Dtv  wrote:

> I need to add textbox dynamically when I click "Add" button.

> How can I achive this functionality?

A client-side action like this is done with JavaScript.

A JS library like Prototype or jQuery can be helpful, but you still have
to write the code :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] add textbox dymamically

2010-05-27 Thread Ravi Dtv
Hii

I need to add textbox dynamically when I click "Add" button.

On clicking on button the textboxes are to be displayed one below the
other.

I enter different text in different textboxes, when clicked submit
button all the content in all the textboxes should be saved.

How can I achive this functionality?

Please help. Thank you.
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Is using script/console in live production environment ok?

2010-05-27 Thread Andy Jeffries
On 27 May 2010 15:45, james  wrote:
> I need to make some minor record changes in the database on my live
> production site. I use Capistrano to deploy. I know I can activate
> script/console by entering my "/current" Capistrano directory and
> running:
>
> RAILS_ENV=production script/console
>
> Are there any dangers or pitfalls to be aware of when using script/
> console to make record changes to a live site in a production
> environment?

No, it's fine - just obviously be careful of what you're doing.

Cheers,


Andy

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Is using script/console in live production environment ok?

2010-05-27 Thread james
I need to make some minor record changes in the database on my live
production site. I use Capistrano to deploy. I know I can activate
script/console by entering my "/current" Capistrano directory and
running:

RAILS_ENV=production script/console

Are there any dangers or pitfalls to be aware of when using script/
console to make record changes to a live site in a production
environment?

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails 3 Error:uninitialized constant ActiveResource::Base

2010-05-27 Thread Felipe Orellana Castillo
well... finally i installed the ruby head-version, and all the little
problems that i had were solved, try that

On May 24, 9:06 am, Felipe Orellana Castillo 
wrote:
> I have the same trouble, but using the ruby 1.9.1
>
> it's a kind of bug?
>
> --
> 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 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Validating and using Kernal.System

2010-05-27 Thread anon_comp
Ok so I have a RoR project that seems to be...unconventional lol

I'm attempting to validate the name of the file and using
Kernal.System to input the file in the system as a parameter.

I've tried validates_presence_of, but that doesn't appear to work
unless in a model which I don't have. I'm trying to use
error_messages_for, but I don't understand how to use it or what to
put in the controller.

As for the Kernal. System, how do you use it so that when the user
hits "OK", RoR inputs the file in the correct command, runs it, and
points the user to the generated html file?

Here's the complete code:

trying_controller.rb
---
class TryingController < ApplicationController
  def index
  end

  def to
@logfile = params[:logfile]
  end

end



index.html.erb
-
<% form_tag :action => 'to' do %>
  <%= error_messages_for 'logfile' %>
  <%= label_tag 'logfile_label', 'Logfile:' %>
  <%= file_field_tag :logfile %>
  <%= submit_tag "OK" %>
<% end %>



to.html.erb

Logfile: <%= @logfile %>


Thanks for any help,
anon_comp

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] HTML character codes in ActionMailer subject

2010-05-27 Thread jhaagmans
Hi,

We have our e-mail subjects stored in I18n locale files. For the
English version of the website, we had no problem, but now we're
translating to German, which uses a lot of symbols like ü and
Ü for example. We store them as character codes in the YAML
files, but most e-mail clients won't parse HTML-code in the subjects.
Is it fine to just use the actual characters in the YAML files? Will
that work on any system?

Thanks in advance!

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: URGENT + production migrations

2010-05-27 Thread anon_comp
> The downside is that migrations will often have a create_table in the
> up method and a drop_table in the down method.  As Hemant said this
> was on a production system, doing as you suggest would lose all his
> live/production data.
>
> Probably not the solution he'd desire :-)


Point taken :)

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: URGENT + production migrations

2010-05-27 Thread Andy Jeffries
On 27 May 2010 15:15, anon_comp  wrote:
> I know this has already been resloved, but instead of creating a new
> migration, you could have gone back to version 0
>
> rake db:migrate VERSION=0
>
> then run rake db:migrate
>
> this should update all migrations you edited.

The downside is that migrations will often have a create_table in the
up method and a drop_table in the down method.  As Hemant said this
was on a production system, doing as you suggest would lose all his
live/production data.

Probably not the solution he'd desire :-)

Cheers,

Andy

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: URGENT + production migrations

2010-05-27 Thread anon_comp
I know this has already been resloved, but instead of creating a new
migration, you could have gone back to version 0

rake db:migrate VERSION=0

then run rake db:migrate

this should update all migrations you edited.

On May 27, 6:55 am, Andy Jeffries  wrote:
> >>> I edited migrations on my local machine and checked in them.. :) Just
> >>> now i realised that this could be the problem of me.
>
> >> It is indeed :-)
>
> > Resolved it. Thanks to all of you with a big smile .. :) :)
>
> Happy to help.
>
> Good luck,
>
> Cheers,
>
> Andy

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Clarification on PayPal gateways!!!

2010-05-27 Thread sathishkumar
Hi All,

I need suggestions and helps from PayPal (PP) users and developers to
clarify about PP gateways. We need to implement PP payment gateway for money
transactions between two users in our site.

We need to accept payments in two ways;

1) From PP a/c. to PP a/c
2) From Credit card to PP account.

I have explored the PP gateways and found that Adaptive Payments provides a
solution for my first scenario in the name of “Simple Payment” API. So that
user can send payment to other users, but as you all know that Adaptive
payment doesn’t support Credit card payment transactions.

Also, I have looked for Express checkout API, It describes that user can
send money to owner’s (site administrator) business a/c but we need to make
transactions between two users.

For Credit Card payment transactions we can use the Direct Payment API which
comes with Express Checkout in Website Payment pro.

Questions and issues are,

1) I cannot use Adaptive payments as in its not supporting Credit Card
payments?
2) Is Express Checkout supports payment option like “simple payment” which
is offered by Adaptive payments?
3) Does Direct Payment API supports flow like “simple Payment” for sending
money PP a/c users from Credit Card users?

Please suggest me better way to implement the PP transactions between PP a/c
to a/c and credit card to PP a/c.

Thanks in advance,
Sathish Kumar Sadhasivam,
E-mail : srssathishku...@gmail.com
Mobile : +91 98948 81242
Skype : ssathishkumar22
Gtalk : sathishjob

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] How to have *_url generate urls with https:// protocol

2010-05-27 Thread Errol Siegel
Hello,

I accidentally posted this to the "Ruby" forum when it should have gone
here -- sorry.

I am using *_path in views and *_url in controllers (with redirect_to,
for example).  It is my understanding that this is generally considered
a good practice.

I want to use my app using https, and thought it would work that way as
long as I loaded the app by browsing to https://my.app.com.  However, it
appears that even if I do this, redirect_to some_model_url generates a
url with a protocol of https://.

How do I get *_url to generate a url with https:// for the protocol?

Regards,
Errol
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] [JOBS] - Looking for Ruby on Rails professionals for Delhi, India

2010-05-27 Thread Indranil
Hi,
We are looking for strong LAMP/Ruby on Rails candidates for one of our
multinational clients (a product company) who are looking to setup a
development center in Delhi/NCR.

Openings are for Technical Leads, Senior Developers and Developers.
Remuneration would be one of the best in the industry.

Here is the Job Description:

* Experienced with multiple languages - our language of choice is Ruby
(on Rails)
* 4+ years of LAMP administration experience
* CSS, AJAX and RJS
* Test Driven Development using RSpec
* Able to mentor junior members, give technical advice and direction,
and provide hands-on management
* Knowledge of a wide range of operating systems and web servers
* Strong troubleshooting skills
* Driven, creative, and result oriented
* Excellent written and verbal communication skills
* Are excited to work in an agile development environment

Additional Skills

* Industry experience coding in Ruby, Perl, and/or Python
* Industry experience in SQL and Relational Database administration,
MS SQL Server
* Industry experience deploying Rails applications with Capistrano,
Monit, Mongrel, and Apache
* Diverse interests and a passion for technology
* Experience in the medical research field

If you have a passion for technology and are interested in joining a
world class product development team, please send your latest resume
with the following details to indrani...@gmail.com

Please provide the following details:

* Your total experience
* Experience in Ruby on Rails
* Your current CTC
* Expected CTC
* Notice period

Even if you are not interested, please don’t ignore this mail.

Please forward this requirement to any of your friends or colleagues
who you think may be appropriate for these openings.

Thanks,
Indranil
indranil73 at gmail.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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Safebuffer with rails 2.3.8

2010-05-27 Thread Loïc Guitaut
Found it! It was a problem with fckeditor plugin.

Le mercredi 26 mai 2010 11:21:41, Loïc Guitaut a écrit :
> Hi there!
> 
> I've just migrated from rails 2.3.5 to 2.3.8 and now I have a lot (and I
> mean a lot!) of deprecation warnings like this one: "DEPRECATION WARNING:
> ActionView::SafeBuffer is deprecated! Use ActiveSupport::SafeBuffer
> instead."
> 
> But I don't understand how to remove this. I searched through installed
> plugins, and there is no reference to SafeBuffer :(
> 
> Any help would be appreciated please.
> 
> Thanks!

-- 
  ,= ,-_-. =.   Loïc Guitaut
 ((_/)o o(\_))  http://www.belfalas.org
  `-'(. .)`-'   Jabber ID : fl...@im.apinc.org
  \_/   GnuPG KeyID : 0xA78CD85D


signature.asc
Description: This is a digitally signed message part.


[Rails] Re: A few questions before i start to programm

2010-05-27 Thread Roelof Wobben
Hello,

To make it more clear.

What I have in mind is this:

Make a application with a menu which contains a input choice and a 
rankings choice.

If the user chooses for input the user gets a form so the data can be in 
the database.

If the user chooses for rankings the followrig occurs.

Every rule in the database is be read.
Then there is a check if the team has already played a game.

If so, then the data will changed .
If not, team is added to a array and the data willbe changed.

After that the data will be sorted so the best team is displayed first 
and so on.

Database will look like this :

Home team
Away team
Score home team
Score away team.

Array looks like this :

Team
Played games
game points
points made by that team
points the other teams made in games with this team.
example team A played 3 games, won 2 , made 50 , other teams made 20
team : A
game points 2*3=6
points : 50
points : 20

I hope it's now clear what i have in mind.

Roelof


-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Can I get meaningful page links using will_paginate?

2010-05-27 Thread Ron Phillips
RonPhillips wrote:
> Ok, I am thinking search by title, then the results are sorted by
> date, so I want to label pages by date.
> There's a series of screenshots at 
> http://www.flickr.com/photos/21409...@n08/
> to show what I mean.
> 
> If I expect lots of search results in a field to be identical, then I
> like to index by some other logical ordering. If that's not possible,
> then "title" must be the only identifier that is human-readable. In
> that case, how does the user decide which one he wants even after he
> searches?
> 
> Ron

Sorry for the crazy posting. I'd just never realized that the Google
Group is actually a reflection of this forum (I mostly lurk.)

Anyway, the flickr screenshots will show what I mean, I hope. How does 
one
do that with will_paginate?

Ron
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Can I get meaningful page links using will_paginate?

2010-05-27 Thread Ron Phillips
RobertWalker wrote:

What I think is even more nuts is to have to slog through 137 pages of
results without having a decent way to filer that down to just a few
pages at most.

For example. I very rarely make it past about page 3 or 4 of a Google
search result set. I'd never make it to page 125.



RonPhillips wrote:
> Exactly! If you search for some term, and then specify an ordering of
> the results, the pages should be labeled with your ordering, not
> numbers.
> 
> Let's say you search for "dengue fever" and then order by author. The
> page links should show the name of the author of the first article on
> the page. Then it's easy to home in on Robert Abernathy, followed by
> Robert Walker, then Frederick Cheung. Why make us guess that "Walker"
> is going to be around 125, then click from page to page? Just label
> the pages with the sorting field.
> 
> Ron

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails 3 beta nested forms

2010-05-27 Thread AppleII717
It never fails! If you are having a problem trying to get something to
work, post something looking for help and within 15 minutes, you'll
figure it out!

I went back and reviewed the railscast on nested forms, which used a
has_many form and answered my 3rd question = you have to have an
array.

In my new action in the Groups controller I just added:

1.times {...@group.users.build}

and changed my fields_for to:

<%= f.fields_for :users do |user_fields| %>

and everything worked!  Singular - plural is something you just always
have to think of.

Steve


On May 27, 6:09 am, AppleII717  wrote:
> Not sure if this the best place to look for rails 3.0 beta 3 help, but
> I'll give it a try.
>
> I can't seem to get nested forms to work in the beta - close but no
> workie!
>
> I used an approach similar to one I used in  a 2.3 application to
> update a user record from a profile record (citizen has_one :user,
> accepts_nested_attributes_for :user ) except I'm try to create a user
> record from a has_many relation (initial registration for a new group/
> subdomain)
>
> class Group < ActiveRecord::Base
>   has_many :users
>   accepts_nested_attributes_for :users, :allow_destroy => true
> end
>
> I have my nested form set up with:
>
>     <%= f.fields_for :user, @user do |user_fields| %>
> ...
>
> The form builds, but not the same has in 2.3
>
> For instance, in 2.3 I'll get:
>
> name="group[user_attributes][password_confirmation]"
>
> in 3 I'll get:
>
> name="group[user][password_confirmation]"
>
> submitting the form will generate an error with unknown variable
> "user"
>
> Has anyone gotten nested forms to work in 3?
> Am I missing some new approach that sets [group][user_attributes]
> instead of [group] [user]?
> Do you have to do something different with a nested has_many relation?
> (since I assume it would normally be an array)
>
> Steve Alex

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] NoMethodError: You have a nil object when you didn't expect

2010-05-27 Thread Manivannanj Jeganathan
Hi,

  I have tried to use searchlogic in my application...
in def index,
 @search = AccounDetail.search(params[:search])
 @account_details = @search.all

In index.rhtml
<%form_for @search do |f|%>
  
<%=f.label :name_like,"Name"%>
<%=f.text_field :name_like%>
<%=submit_tag :Search,:name=>nil%>
  
<%end%>

I didn't get any search result...
i tried it with ruby script/console.
when i call @search.all, i got "NoMethodError: You have a nil object
when you didn't expect"


example

>>search=AccountDetail.search(:name_like_any=>"xx")
>>search.all

give me a suggestion to solve this problem
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: A few questions before i start to programm

2010-05-27 Thread Roelof Wobben
Alex P wrote:
> Actually, the goal is trivial.
> Check out http://guides.rubyonrails.org/getting_started.html
> 
> Install ruby, gem, rails, and start developing, ask questions as you
> go along. There's no such thing as tutorial for a menu or working
> space.
> Checking whether a team has already played the game is a matter of
> your model. For instance, you have a model called Team, which has a
> boolean field called played_game. So, you just get teams via
> Team.find, and include your condition, or just use team.played_game
> and check whether it's true or no.
> 
> Good luck

Hello,

Thank you.
I will read the gettting_started tutorial.

I like the idea of you.
One question. How do I set the boolean field.

My idea was to make a database of all the played games.
Then read that database one or one if the user choose for making the 
rankings.

I have he idea I have to read a lot to make this idea work.

Roelof
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Generator Documentation

2010-05-27 Thread James
Sorry, to clarify this I mean in *writing* my own generators - using the
Thor built in actions, the Rails ones, etc. Rails templates are what I'm
actually trying to build.


James


On Thu, May 27, 2010 at 6:47 PM, Alex P  wrote:

> if you enter script/generate –help you get a list of possible
> generators.
>
> for example, script/generate model –help gives you help on the model
> generator
>
>
> On May 27, 10:16 am, James Nelson  wrote:
> > Hi,
> >
> > I'm new to this list so sorry if i'm posting in the wrong place.
> >
> > I've just been looking through documentations for generators, as I've
> > been trying to make a rails template for the various projects I'm
> > doing now. It turns out that there really isn't any - especially for
> > rails 3. I dug through the source and ended up finding out that a lot
> > of the possible generator commands are part of thor, not rails.
> >
> > Did I just miss the documentation, or is this something that people
> > (like me, maybe) can get involved with?
>
> --
> 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
> rubyonrails-talk+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Can I get meaningful page links using will_paginate?

2010-05-27 Thread RonPhillips
Exactly! If you search for some term, and then specify an ordering of
the results, the pages should be labeled with your ordering, not
numbers.

Let's say you search for "dengue fever" and then order by author. The
page links should show the name of the author of the first article on
the page. Then it's easy to home in on Robert Abernathy, followed by
Robert Walker, then Frederick Cheung. Why make us guess that "Walker"
is going to be around 125, then click from page to page? Just label
the pages with the sorting field.

Ron

On May 26, 12:12 pm, Robert Walker  wrote:
> RonPhillips wrote:
> > That's nuts.You should have the choice of 137 pages with the date of
> > the first post on the page displayed as the page link.  Start on page
> > "Jan 7, 2010" and read forward. That's easy. Jakob Nielsen agrees with
> > me, so there!http://rooh.it/PageNumbersMeaningless
>
> What I think is even more nuts is to have to slog through 137 pages of
> results without having a decent way to filer that down to just a few
> pages at most.
>
> For example. I very rarely make it past about page 3 or 4 of a Google
> search result set. I'd never make it to page 125.
> --
> Posted viahttp://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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Can only traverse a polymorphic association in one direction

2010-05-27 Thread BarryOg

Hi all, I'm working on a polymorphic association and I've run into a bit of a
stumbling block.  I only seem to be able to traverse the relationship in one
direction and not the other.  This is what my code looks like:


class NodeEntry < ActiveRecord::Base
  acts_as_nested_set
  belongs_to :node, :polymorphic => true
end

class Location < ActiveRecord::Base
attr_accessor :name
has_one :node_entry, :as => :node
validates_presence_of :country, :region, :name
end

class Meter < ActiveRecord::Base
  attr_accessor :name, :parent_id
  has_one :node_entry, :as => :node
  validates_presence_of :meter_identifier, :type_of_meter
end

class MeterGroup < ActiveRecord::Base
  has_one :node_entry, :as => :node
end

When I create a new location or meter I use the following code:
@location = Location.new(params[:location])
@location_node = NodeEntry.new(:name => params[:location][:name])
@location_node.node = @location
@location_node.save

After loading a location or meter object from the database, when I attempt
to do a location.node I get an error saying the object doesn't have that
method.  When I load a node entry object I have no problem accessing its
node and I get the correct class back.

I can get around this by doing a simple query such as:
NodeEntry.first(:conditions => "node_id = #{loc.id} and node_type =
'Location'").name

but I had assumed active record should be doing this for me under the
covers.  Have I made a mistake somewhere or is this the expected behavior of
polymorphic associations? 

-- 
View this message in context: 
http://old.nabble.com/Can-only-traverse-a-polymorphic-association-in-one-direction-tp28692572p28692572.html
Sent from the RubyOnRails Users mailing list archive at Nabble.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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Can I get meaningful page links using will_paginate?

2010-05-27 Thread RonPhillips
Ok, I am thinking search by title, then the results are sorted by
date, so I want to label pages by date.
There's a series of screenshots at http://www.flickr.com/photos/21409...@n08/
to show what I mean.

If I expect lots of search results in a field to be identical, then I
like to index by some other logical ordering. If that's not possible,
then "title" must be the only identifier that is human-readable. In
that case, how does the user decide which one he wants even after he
searches?

Ron

On May 26, 11:05 am, Frederick Cheung 
wrote:

> You can supply a custom LinkRenderer class to will_paginate, which
> controls how page links are displayed. You might need to do some
> messing around in order to get the data for each page link - i think
> the link renderer is given the will paginate collection object and the
> fact that this is the link for page 23. Does it matter that if there
> were suddenly a lot of articles about a given subject that you'd then
> have several page links all with the same title ?
>
> Fred
> > Ron

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Rails 3 beta nested forms

2010-05-27 Thread AppleII717
Not sure if this the best place to look for rails 3.0 beta 3 help, but
I'll give it a try.

I can't seem to get nested forms to work in the beta - close but no
workie!

I used an approach similar to one I used in  a 2.3 application to
update a user record from a profile record (citizen has_one :user,
accepts_nested_attributes_for :user ) except I'm try to create a user
record from a has_many relation (initial registration for a new group/
subdomain)


class Group < ActiveRecord::Base
  has_many :users
  accepts_nested_attributes_for :users, :allow_destroy => true
end

I have my nested form set up with:

<%= f.fields_for :user, @user do |user_fields| %>
...

The form builds, but not the same has in 2.3

For instance, in 2.3 I'll get:

name="group[user_attributes][password_confirmation]"

in 3 I'll get:

name="group[user][password_confirmation]"

submitting the form will generate an error with unknown variable
"user"

Has anyone gotten nested forms to work in 3?
Am I missing some new approach that sets [group][user_attributes]
instead of [group] [user]?
Do you have to do something different with a nested has_many relation?
(since I assume it would normally be an array)


Steve Alex


-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Re: URGENT + production migrations

2010-05-27 Thread Andy Jeffries
>>> I edited migrations on my local machine and checked in them.. :) Just
>>> now i realised that this could be the problem of me.
>>
>> It is indeed :-)
>
> Resolved it. Thanks to all of you with a big smile .. :) :)

Happy to help.

Good luck,

Cheers,


Andy

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Re: URGENT + production migrations

2010-05-27 Thread Hemant Bhargava
Andy Jeffries wrote:
>>> Did you create new migrations or edit existing ones?
>>
>> I edited migrations on my local machine and checked in them.. :) Just
>> now i realised that this could be the problem of me.
> 
> It is indeed :-)

Resolved it. Thanks to all of you with a big smile .. :) :)

> 
>> Ok tell me one thing, if i edit a already migration file, and run rake
>> db:migrate then would that column be get affected.. ?
> 
> Nope.  The schema_migrations table in your database holds a list of
> ids that have already been applied, so editing existing migrations
> that have already been applied will not apply them again.
> 
> You need to create a new migration and put all your changes in there.
> 
> Cheers,
> 
> 
> Andy

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] How to pass an Variable to an Partial?!?

2010-05-27 Thread Colin Law
On 27 May 2010 11:20, happysmiley  wrote:
> Hello,
> I'm new in Rails and I'm Trying to implement a plattform were
> authorized people can apply Profiles to a special topic.
> The profil can be identified by the ID and the title in the data
> base.
> So in the view/profil/show_profil.html.erb the infomation of one
> Profil are perfektly shown.
>
> My problem:
> I have an data base table called : "comment" in which I save comments
> users made to one Profil, identifed by the Profil ID which I also save
> in this table.
> My Idea was to invoke an partial in the View/profil/
> show_profil.html.erb... something like:
>
>          <%= render :partial => "comments/comments_show" %>
>
> But how can I find and show the comments with the ID of the used
> Profil?!?!?
> Can I handover the Profil_ID somehow and if so how can I use it?

Have a look at the docs at
http://rails.rubyonrails.org/classes/ActionController/Base.html to see
how to pass data to a partial.  A google search for render partial
puts this as the first hit.

Colin

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: A few questions before i start to programm

2010-05-27 Thread Alex P
Actually, the goal is trivial.
Check out http://guides.rubyonrails.org/getting_started.html

Install ruby, gem, rails, and start developing, ask questions as you
go along. There's no such thing as tutorial for a menu or working
space.
Checking whether a team has already played the game is a matter of
your model. For instance, you have a model called Team, which has a
boolean field called played_game. So, you just get teams via
Team.find, and include your condition, or just use team.played_game
and check whether it's true or no.

Good luck

On May 26, 8:17 pm, Roelof Wobben  wrote:
> Hello,
>
> I want to learn ruby.
> As a learning experience I want to write a programm which people can put
> the results of games in a tournament. The programm produces which team
> is first and  so on.
>
> My question is :
>
> 1) Are there any tutorials about making a menu and working space ?
> 2) Are there any tutorial about how i can check if a team has already
> played a game.
> 3) Are there any totorials about how I can sort the teams on multiple
> things ?
>
> Roelof
> --
> Posted viahttp://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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] How to pass an Variable to an Partial?!?

2010-05-27 Thread happysmiley
Hello,
I'm new in Rails and I'm Trying to implement a plattform were
authorized people can apply Profiles to a special topic.
The profil can be identified by the ID and the title in the data
base.
So in the view/profil/show_profil.html.erb the infomation of one
Profil are perfektly shown.

My problem:
I have an data base table called : "comment" in which I save comments
users made to one Profil, identifed by the Profil ID which I also save
in this table.
My Idea was to invoke an partial in the View/profil/
show_profil.html.erb... something like:

  <%= render :partial => "comments/comments_show" %>

But how can I find and show the comments with the ID of the used
Profil?!?!?
Can I handover the Profil_ID somehow and if so how can I use it?

It was hard for me to explain my problem and I hope this was
understandable.
Hope to get some Ideas and solutions.

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Generator Documentation

2010-05-27 Thread Alex P
if you enter script/generate –help you get a list of possible
generators.

for example, script/generate model –help gives you help on the model
generator


On May 27, 10:16 am, James Nelson  wrote:
> Hi,
>
> I'm new to this list so sorry if i'm posting in the wrong place.
>
> I've just been looking through documentations for generators, as I've
> been trying to make a rails template for the various projects I'm
> doing now. It turns out that there really isn't any - especially for
> rails 3. I dug through the source and ended up finding out that a lot
> of the possible generator commands are part of thor, not rails.
>
> Did I just miss the documentation, or is this something that people
> (like me, maybe) can get involved with?

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: URGENT + production migrations

2010-05-27 Thread Andy Jeffries
>> Did you create new migrations or edit existing ones?
>
> I edited migrations on my local machine and checked in them.. :) Just
> now i realised that this could be the problem of me.

It is indeed :-)

> Ok tell me one thing, if i edit a already migration file, and run rake
> db:migrate then would that column be get affected.. ?

Nope.  The schema_migrations table in your database holds a list of
ids that have already been applied, so editing existing migrations
that have already been applied will not apply them again.

You need to create a new migration and put all your changes in there.

Cheers,


Andy

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: URGENT + production migrations

2010-05-27 Thread Frederick Cheung


On May 27, 11:16 am, Hemant Bhargava  wrote:
>
> I edited migrations on my local machine and checked in them.. :) Just
> now i realised that this could be the problem of me.
>
> Ok tell me one thing, if i edit a already migration file, and run rake
> db:migrate then would that column be get affected.. ?

No. rails stores which migrations have been run - if you edit it after
it's been run rails won't run it again.

Fred

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: URGENT + production migrations

2010-05-27 Thread Hemant Bhargava
Andy Jeffries wrote:
> 
> Have you changed database configuration in your database.yml?

No. I have'nt changed.

> 
> Are you getting any error messages (command line or in the log)?

No i am not getting any error message at command line/log file.

> 
> Did you create new migrations or edit existing ones?

I edited migrations on my local machine and checked in them.. :) Just 
now i realised that this could be the problem of me.

Ok tell me one thing, if i edit a already migration file, and run rake 
db:migrate then would that column be get affected.. ?

> 
> Does the list of applied migrations (select * FROM schema_migrations;)
> match the list of migrations you expect to have been run (excluding
> the new ones you're thinking should run)?

Did not checked this.


> 
> Does "script/console production" work and give you access to your
> production system?

Yeah.


> 
> Are you using a SQLite production database (I don't know how big your
> site is) that is then being removed and symlinked from a shared DB by
> Capistrano after migration?

I am using MySql.

> 
> Running out of ideas until I get some answers...
> 
> Cheers,
> 
> 
> Andy
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] URGENT + production migrations

2010-05-27 Thread Andy Jeffries
> I am in a great need of you people. My migrations are not running on
> production database. I done some changes in production mode and then i
> ran rake db:migrate RAILS_ENV=production / RAILS_ENV="production". But
> my database is not reflecting. Can you people tell me that what are the
> possible combinations of mistake i am doing .. :)

Have you changed database configuration in your database.yml?

Are you getting any error messages (command line or in the log)?

Did you create new migrations or edit existing ones?

Does the list of applied migrations (select * FROM schema_migrations;)
match the list of migrations you expect to have been run (excluding
the new ones you're thinking should run)?

Does "script/console production" work and give you access to your
production system?

Are you using a SQLite production database (I don't know how big your
site is) that is then being removed and symlinked from a shared DB by
Capistrano after migration?

Running out of ideas until I get some answers...

Cheers,


Andy

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] rails 2.3.8 and I18n

2010-05-27 Thread Loïc Guitaut
Ok just found that now I have to add 'html' to all I18n keys that use html in 
their translations for this to work properly...

While I can understand this approach, it's quite annoying when migrating an 
app from a previous version :(

Le mercredi 26 mai 2010 18:13:39, Loïc Guitaut a écrit :
> Hi all!
> 
> I'm having some troubles since I'm using rails 2.3.8 and XSS plugin. All
> data from I18n yaml files is now escaped! That's not what I want, and it
> seems pretty logic that data from these files should be safe for html.
> 
> So my question is: how do I do that please? I already tried with an
> initializer and alias_method_chain on the I18n module translate method, but
> so far no luck (works great in console but not in views...)
> 
> Thanks!

-- 
  ,= ,-_-. =.   Loïc Guitaut
 ((_/)o o(\_))  http://www.belfalas.org
  `-'(. .)`-'   Jabber ID : fl...@im.apinc.org
  \_/   GnuPG KeyID : 0xA78CD85D


signature.asc
Description: This is a digitally signed message part.


[Rails] URGENT + production migrations

2010-05-27 Thread Hemant Bhargava
Champs,

I am in a great need of you people. My migrations are not running on
production database. I done some changes in production mode and then i
ran rake db:migrate RAILS_ENV=production / RAILS_ENV="production". But
my database is not reflecting. Can you people tell me that what are the
possible combinations of mistake i am doing .. :)
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: A few questions before i start to programm

2010-05-27 Thread Frederick Cheung


On May 27, 9:33 am, roelof  wrote:
> Hello,
>
> Really nobody who wants to help ?

I think you questions are a mixture of over vague and over specific,
for example i don't think you'll ever find a tutorial for your second
question as that's quite a narrow question that depends quite tightly
on how you'll decide to store the team & tournament data. Your first
question on the other hand is very vague. I think you should probably
be looking for some basic active record tutorials (perhaps read some
of the guides at guides.rubyonrails.org) before trying to find
something more specific to what you're trying to do.

Fred

>
> Roelof
>
> On 26 mei, 19:17, Roelof Wobben  wrote:
>
>
>
> > Hello,
>
> > I want to learn ruby.
> > As a learning experience I want to write a programm which people can put
> > the results of games in a tournament. The programm produces which team
> > is first and  so on.
>
> > My question is :
>
> > 1) Are there any tutorials about making a menu and working space ?
> > 2) Are there any tutorial about how i can check if a team has already
> > played a game.
> > 3) Are there any totorials about how I can sort the teams on multiple
> > things ?
>
> > Roelof
> > --
> > Posted viahttp://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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: A few questions before i start to programm

2010-05-27 Thread roelof
Hello,

Really nobody who wants to help ?

Roelof

On 26 mei, 19:17, Roelof Wobben  wrote:
> Hello,
>
> I want to learn ruby.
> As a learning experience I want to write a programm which people can put
> the results of games in a tournament. The programm produces which team
> is first and  so on.
>
> My question is :
>
> 1) Are there any tutorials about making a menu and working space ?
> 2) Are there any tutorial about how i can check if a team has already
> played a game.
> 3) Are there any totorials about how I can sort the teams on multiple
> things ?
>
> Roelof
> --
> Posted viahttp://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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Generator Documentation

2010-05-27 Thread James Nelson
Hi,

I'm new to this list so sorry if i'm posting in the wrong place.

I've just been looking through documentations for generators, as I've
been trying to make a rails template for the various projects I'm
doing now. It turns out that there really isn't any - especially for
rails 3. I dug through the source and ended up finding out that a lot
of the possible generator commands are part of thor, not rails.

Did I just miss the documentation, or is this something that people
(like me, maybe) can get involved with?

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Success message when using button_to_remote

2010-05-27 Thread Frederick Cheung


On May 27, 5:58 am, Ravi Dtv  wrote:
> Hii
>
> In a partial I used button_to_remote for deleting record.
>
> My record is deleted but message is not firing.
>
>  <%= button_to_remote "Delete", :url => {:controller => "users" ,
> :action => "deletegroup", :group_name=>grouprow.group_name}, :class =>
> "submit_input_button rounded_corner" %>
>
With a button_to_remote like that you're going to have to display the
message yourself - either supply an onSuccess callback or write some
rjs / call an rjs template ni your respond_to block that displays a
message.

Fred

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RJS suitable for doing interactivities within a webpage?

2010-05-27 Thread Frederick Cheung


On May 27, 6:48 am, Jian Lin  wrote:
> RJS is very good for sending Javascript code back to the browser saying
> "Your AJAX is successful and by the way you can update the UI to signal
> to the user using the following Javascript I am going to send you."
>
> How about other webpage interactivities, dynamic HTML, is RJS suited for
> doing that as well, or is Prototype.js, or jQuery, or plain Javascript
> statically loaded with the webpage, still more suited for doing it?

Well stuff like link_to_function, button_to_function etc... do allow
you to supply a block (which yields an RJS page object) rather than a
javascript fragment and there's also the update_page helper which can
turn a block of rjs into actual javascript. I've always thought of RJS
as a bit of a crutch though. It doesn't get too much in your way for
simple stuff like toggle this field or highlight that object but
beyond that it has its limitations. It's awkward to test for example
and fiddly to setup reusable classes or functions. If you need any
substantial amount of javascript I really thing you should bite the
bullet and just get comfortable with javascript (using a library like
jquery or prototype is almost certainly a smart move though)

Fred

-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



  1   2   >