[Rails] New page in Export Word (.doc)

2009-03-20 Thread CSK Vasanth

Hello Everyone,
I have nearly 13 reports in my application, the user can select
whichever report(s) he wants to view/export to DOC file.

So whenever the user selects more than 1 report, I am supposed to give a
page-break. I have solved this issue in View report (html file) with
this CSS style = style='page-break-before:always;'.

But I am unable to do the same while Exporting it to a word document.
Here is the method which I am using,

  def export_report
date_value = Date.today
filename = report_+date_value.to_s+.doc
headers['Pragma'] = public
headers[Content-type] = application/msword
headers['Cache-Control'] = no-cache, must-revalidate, post-check=0,
pre-check=0
headers['Content-Disposition'] = attachment;
filename=\#{filename}\
headers['Expires'] = 0
report_content = Report.generate_report_content()
render :text = report_content
return false
  end

Could anyone please help me to solve this issue?

Thanks in advance,
Vasanth
-- 
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-talk@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: Getting Started

2009-03-20 Thread Jeffrey L. Taylor

Quoting David James rails-mailing-l...@andreas-s.net:
 
 Experienced developer here just attacking Ruby on Rails.
 
 So, I bought myself a book (Beginning Ruby on Rails - Holzner) and
 proceeded to follow the tutorial for the first project.   I start up
 Webrick which seems to be working properly.  Then, after
 editing/creating the two simple files per the instructions I point my
 browser at http://localhost:3000/app/greeting.  Instead of seeing the
 result I was expecting, I got:
 
 =
 We're sorry, but something went wrong.
 We've been notified about this issue and we'll take a look at it
 shortly.
 =
 
 Now, I've actually tried a couple of different tutorials with the same
 result.  When this is displayed in my browser, I also get this webrick
 logging (below) in the dos box it is running in, but have no idea what
 it means.
 
 Since I've been stuck on this a couple days if anyone can point me to an
 approach to getting past this I will greatly appreciate it.  Everything
 I've done with the tutorial seems to have worked correctly through this
 process -- the rails command, the generate controller, starting webrick,
 all seem straightforward and like they're working as expected.
 
 TIA
 
 Dave
 
 /!\ FAILSAFE /!\  Fri Mar 20 00:12:27 -0500 2009
   Status: 500 Internal Server Error
   no such file to load -- sqlite3
[snip]

The sqlite3 gem is not installed.  This is now the default database adapter.
Rails is a fast moving target and tutorials are quickly out of date.  It used
to be MySQL (at least on Linux and I think MacOS).  If you have installed a
different database adapter, set the correct value in config\database.yml.
Otherwise, install the sqlite3.

HTH,
  Jeffrey

--~--~-~--~~~---~--~~
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-talk@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: Converting Array to String in a model using before filters

2009-03-20 Thread vimal


Thanks again Fred to make me try this out...
I got it after analysing ur reply further

So the trick is not to add a attr_accessor for lists_selected

Regards,
Vimal Das
--~--~-~--~~~---~--~~
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-talk@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: Converting Array to String in a model using before filters

2009-03-20 Thread vimal


Thanks again Fred to make me try this out...
I got it after analysing ur reply further

So the trick is not to add a attr_accessor for lists_selected

Regards,
Vimal Das
--~--~-~--~~~---~--~~
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-talk@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 pass javascript variable value to a Session Variable in javascript

2009-03-20 Thread Shripad

Hi Starr,

Thank u for ur nice reply.

I have done the first part what u have mentioned by using
document.cookie.
I am new to XMLHttpRequest(XHR) will you please guide me a little more
on this with example.
I have following code written in javascript

var selObj = document.getElementById('zone');
var i;
var count = 0;
for (i=0; iselObj.options.length; i++) {
if (selObj.options[i].selected) {
selectedArray[count] = selObj.options[i].value;
count++;
}
}
document.cookie=zone_ids= + selectedArray.toString();
 var r = document.cookie;


  I want to pass this cookie value to my account controller method
say add

  And after passing how can I access it in the controller?

I am googleing for the same but don't find good materials.
Please help me out

Thanks and Regards,
Shripad

On Mar 19, 6:49 pm, Starr Horne st...@chatspring.com wrote:
  Can any one tell me, how can I Pass a  javascript variable value to a
  ROR session variale in javascript.

 You can either:

 1) Set a cookie in JS and have your rails app read the cookie. If you're 
 using not using DB-backed sessions, this may be sufficient. You may not need 
 to use rails' actual sessions mechanism.

 2) Have your JS do an XHR request to a special controller action which will 
 save your data to the session.

 --
 Starr Horne
 Check out my Helpdesk RailsKit:http://railskits.com/helpdesk/
--~--~-~--~~~---~--~~
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-talk@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: Where is my message

2009-03-20 Thread Damjan Rems

Frederick Cheung wrote:
 On Mar 19, 1:38�pm, Damjan Rems rails-mailing-l...@andreas-s.net
 wrote:

 p flash returns {}

 Are you putting an error message in the flash ?
 
 Fred

Yes where my program is doing control, but this is ROR's buildin method. 
Where does it put the message?

by
TheR


-- 
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-talk@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: Redirecting to another controller, with a POST method

2009-03-20 Thread Vahagn Hayrapetyan

Hi MaD,-

yep, I can see your line of reasoning. It appears that it is probably 
not very RESTful to check for POST, so that can be dropped altogether. 
It seems conceptually wrong that you need to ensure something is 
POST'ed, but then it only works from a view and not a controller. If 
something is POST'ed, I think it should be uniform throughout the 
application / MVC stack. Convention over configuration / principle of 
least surprise. Just my 5 cents.

Cheers, Vahagn
-- 
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-talk@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: Authentication plugins

2009-03-20 Thread Bob Martens

Restful Authentication and I think there is some movement behind
Authlogic as well. Someone please correct me if I have that wrong.

However, I think there is some merit in actually sitting down and
rolling your own as well. If anything, it allows you to learn a little
bit more about Rails and how authentication works as well. A win-win
in my estimation.

On Mar 19, 7:03 pm, ricardonns ricardo...@gmail.com wrote:
 Hey there.

 I am starting a new development and am still a newbie in rails, so i'd
 like to ask witch authentication plugin do you sugest?

 Regards,
 Ricardo
--~--~-~--~~~---~--~~
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-talk@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: Settings for CDN, GZip, Header Expires for BEtter Yslow

2009-03-20 Thread Ankit Parekh

Ankit Parekh wrote:
 OH just noticed. In this forum itself they have added analytics code 
 still they r getting A grade.
 
 How they have done it? They are using litespeed server and i m using 
 nginx thats the only diff.

no one out there to help me out? Can ne one know how this site i.e 
ruby-forum.com manages to get Yslow grade A inspite the fact that it 
uses google analytics code in the site?

since when i add the code it reduces the Header Expires and Gzip 
component grade to B from A

thanks
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@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: Factory Girl Associations Issue with Uniqueness Validations

2009-03-20 Thread Andrew Timberlake

On Thu, Mar 19, 2009 at 8:01 PM, mirts dasmi...@gmail.com wrote:

 I have exactly the same problem... but no solution. Would also greatly
 appreciate suggestions as to a workaround.

 


When I encounter this type of issue, I tend to create the high level
objects and then explicitly include them

@author = Factory(:author)

book1 = Factory(:book, :author = @author)
book2 = Factory(:book, :author = @author)
etc.

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

I have never let my schooling interfere with my education - Mark Twain

--~--~-~--~~~---~--~~
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-talk@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] New page in Export Word (.doc)

2009-03-20 Thread CSK Vasanth

By the way, is there any GEM available for doing Export to Word document 
just like PDF::Writer?
-- 
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-talk@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: Charts in Rails

2009-03-20 Thread motine

gnuplot doesn't really look nice and the flash / js / css solutions do
not really fit my requirement of creating charts on the server side.
I found Eastwood (http://www.jfree.org/eastwood/) which emulates
Google Charts but you may run it on your own server. This is quite a
good solution, but I do not really like the idear of having to run a
servlet container.

any further idears?
--~--~-~--~~~---~--~~
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-talk@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] Polymorphic URL's and Uncountable Resources

2009-03-20 Thread spike22

Hi everyone, I've noticed an inconsistency in the way rails deals with
uncountable resources and restful routes.

Basically if you map an uncountable resource rails will append
'_index' to the end of some routes to avoid route clashes between the
routes that deal with singular resources and plural resources. That's
all fine but on the other end, with the polymorphic path generator, it
doesn't generate the correct path. using form_for [...@podcast_series]
generates something like podcast_series_path. If called from a form it
should be smart enough to realise that we want the update path and
call podcast_series_index_path.

Has anyone else come up against it? I'm not savvy enough to write a
patch for rails so how do I get this investigated? Does anyone have a
solution?

Cheers,

Brendon
--~--~-~--~~~---~--~~
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-talk@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: find_by_sql and xml_serializer problems

2009-03-20 Thread Magnus Holmlund

cinderedmonkey wrote:
 Hmm...strange. Well, not really strange as I understand what you are
 saying but it's strange that there is no full support. I would think
 that I am not the only one that would want to search from multiple
 tables...
 
 On Sep 4, 3:31�am, Frederick Cheung frederick.che...@gmail.com

Hi,
did you ever find a solution for this as I'm having exactly the same 
problem as you describe here? Since the xml I'm producing is public I 
cannot really change it and since I don't need the type (I use the 
:skip_types option) I cannot understand why the code producing this 
warning haven't been modified yet. I'm running rails 2.2.2. Well, any 
input would be great.
-- 
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-talk@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 (undefined method `call' for nil:NilClass):

2009-03-20 Thread Jigu

I am getting HTTP 500 Internal server error when updating info for one
of page of my website. Please help me and for your reference i have
posted ruby trace below:

Processing ModelsController#update (for 203.187.233.94 at 2009-03-20
02:40:06) [PUT]
  Session ID:
BAh7CDoMY3NyZl9pZCIlYTc0NDc5OWI1ZDNhMDM4YmVjZTY0YjE3NGZkODQ2
YjAiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh
c2h7AAY6CkB1c2VkewA6DHVzZXJfaWRpBw==--0cc7b78313f817b2be3cc19a19164dbfa9a351e9
  Parameters: {commit=Update, action=update,
_method=put,
authenticity_token=47bc4f13abf32c82e7602e1ebd52f5a5338a566d,
id=12, controller=admin/models, model={city=Surat,
biography=, measurements=, weight=110,
agency_rep_email=, agency_address=, country_id=1,
approved=0, agency_name=, region_id=1, sex=m,
agency_rep_name=, height=5'3, first_name=Jignesh,
agency_phone=, eye_color_id=3, hair_color_id=9,
age=30, last_name=Wadia}}


NoMethodError (undefined method `call' for nil:NilClass):
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/mime_responds.rb:156:in `respond'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/mime_responds.rb:154:in `each'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/mime_responds.rb:154:in `respond'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/mime_responds.rb:107:in `respond_to'
/app/controllers/admin/models_controller.rb:64:in `update'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/base.rb:1162:in `send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/base.rb:1162:in `perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/filters.rb:580:in `call_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/filters.rb:573:in `perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/rescue.rb:201:in `perform_action_without_caching'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/caching/sql_cache.rb:13:in `perform_action'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/
active_record/connection_adapters/abstract/query_cache.rb:33:in
`cache'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/
active_record/query_cache.rb:8:in `cache'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/caching/sql_cache.rb:12:in `perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/base.rb:529:in `send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/base.rb:529:in `process_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/filters.rb:569:in
`process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/session_management.rb:130:in `process'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/base.rb:389:in `process'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:149:in `handle_request'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:107:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:104:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:104:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:120:in `dispatch_cgi'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
action_controller/dispatcher.rb:35:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
103:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
153:in `with_signal_handler'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
101:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
78:in `process_each_request'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in
`each'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
77:in `process_each_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
76:in `catch'

[Rails] Session data and 304 Not Modified HTTP code

2009-03-20 Thread Jeff Kize

I am storing an id in the session data.  An action causes the id to
change, however, the rendered action has not changed.  The server
returns a 304 Not Modified code and doesn't return the cookie.  With
Rails 2.2.2, I believe it is using the CookieStore for sessions, so I
expect the cookie to update.

When I hit the site again, the old session data is used.  Is there a
way to use the new session data?

Thanks,
Jeff.

--~--~-~--~~~---~--~~
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-talk@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] losing session in rails 2.3.2 app using subdomain

2009-03-20 Thread zen

hi

i have a 2.2.3 app which i upgraded to 2.3.2
it's a multi-site (using subdomain) that creates one top level session
for all sites.

this is how i change the domain for the session in production.rb:

ActionController::Base.session_options[:domain] = xxx.com
# in rails 2.2.2, this is what i used to do:
# ActionController::Base.session_options[:session_domain] = xxx.com

strange things started to happen after i upgraded i can no longer
login using restful authentication; it does authenticate me, but as
soon as i'm redirected, it would ask me to login again.

as i said, i use restful_authentication and i also use passenger
2.1.2. anyone can help?
hope i'm not doing smth ultrally stupid...

ps. i posted this question on stackoverflow.com, u can head there to
answer the question if you wish...
http://stackoverflow.com/questions/663893/losing-session-in-rails-2-3-2-app-using-subdomain
--~--~-~--~~~---~--~~
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-talk@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: Where is my message

2009-03-20 Thread Frederick Cheung



On Mar 20, 6:46 am, Damjan Rems rails-mailing-l...@andreas-s.net
wrote:
 Frederick Cheung wrote:
  On Mar 19, 1:38 pm, Damjan Rems rails-mailing-l...@andreas-s.net
  wrote:

  p flash returns {}

  Are you putting an error message in the flash ?

  Fred

 Yes where my program is doing control, but this is ROR's buildin method.
 Where does it put the message?

Sorry, without seeing some code I'm not at all sure what you're on
about.

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-talk@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: find_by_sql and xml_serializer problems

2009-03-20 Thread Magnus Holmlund

Magnus Holmlund wrote:
 cinderedmonkey wrote:
 Hmm...strange. Well, not really strange as I understand what you are
 saying but it's strange that there is no full support. I would think
 that I am not the only one that would want to search from multiple
 tables...
 
 On Sep 4, 3:31�am, Frederick Cheung frederick.che...@gmail.com
 
 Hi,
 did you ever find a solution for this as I'm having exactly the same 
 problem as you describe here? Since the xml I'm producing is public I 
 cannot really change it and since I don't need the type (I use the 
 :skip_types option) I cannot understand why the code producing this 
 warning haven't been modified yet. I'm running rails 2.2.2. Well, any 
 input would be great.

Additional information:
As for now I'm running this patch to avoid the problem. Not very nice 
but it works. Feel free to comment.

#Removes a warning informing about type is deprecated
#/var/lib/gems/1.8/gems/activerecord-2.1.0/lib/active_record/serializers/xml_serializer.rb:308:
 
warning: Object#type is deprecated;use Object#class
#See 
http://rails.lighthouseapp.com/projects/8994/tickets/732-deprecation-warning-in-xml_serializer-rb-308
#and http://www.ruby-forum.com/topic/164048
module ActiveRecord #:nodoc:
  class XmlSerializer  ActiveRecord::Serialization::Serializer #:nodoc:
class Attribute #:nodoc:
  def compute_type
  type = @record.class.serialized_attributes.has_key?(name) ? 
:yaml : (@record.class.columns_hash[name].nil? ? nil.class : 
@record.class.columns_hash[name].type)

  case type
when :text
  :string
when :time
  :datetime
else
  type
  end
end
end
  end
end
-- 
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-talk@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: installed ruby ver 1.9 but not working with rails 2.3.2

2009-03-20 Thread Wolas!

Thanks for the lesson greg.

Maybe i wasnt using the correct terminlogy, that having been done by
years of explaining such concepts to people that dont know what
binaries are and english not being my first language.

Nevertheless, VS is using one version of ruby with one set of gems and
running the other version which doesnt happen to have those set of
gems, and this happened by following your advice. That is what i was
trying to say.

so, here are my 2 cents. use defaults for starters, dont go for the
installing in som/weird/place/, have one version of ruby and one set
of gems, like this you are less likely to run into these problems.

On Mar 17, 4:47 pm, Greg Donald gdon...@gmail.com wrote:
 2009/3/17 Wolas! jcpen...@gmail.com:

  When you followed gregs advice you ended up sort of fooling the ruby
  command. now you have two of everything (2 rails gems, one under 1.8
  and one under 1.9).

 There's no such thing as a ruby command (at least not in my shell).
 There is a ruby binary, and there's a path that might find it
 depending on where you put it and what directories your path contains.
  Being able to change the path so it can find a different ruby binary
 other than the one that came with the system is a feature of the
 system, seriously.. no fooling.  You can have your entire ruby
 toolchain living out of /some/place/weird while completely ignoring
 the ruby that came with the system, you only have to adjust the paths
 to include the weird place.  That's how it works, it's not magic, no
 fooling.

  make sure you are calling the correct gem from the correct place. If i
  were you, i would uninstall one of your ruby instalations (at this
  point 1.8)

 That's all together not necessary.  I suspect all of my development
 systems have two ruby installs.  I ignore the one that came with the
 system and install my own whereever I want.  I update my bashrc so it
 knows about my intentions and that's about it.

 --
 Greg Donaldhttp://destiney.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-talk@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: Redirecting to another controller, with a POST method

2009-03-20 Thread Fernando Perez

Hi,

You cannot redirect with a POST method, so you'll have to find a trick 
to circumvent that issue.
-- 
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-talk@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: installed ruby ver 1.9 but not working with rails 2.3.2

2009-03-20 Thread Frederick Cheung



On Mar 17, 3:47 pm, Greg Donald gdon...@gmail.com wrote:
 2009/3/17 Wolas! jcpen...@gmail.com:

  make sure you are calling the correct gem from the correct place. If i
  were you, i would uninstall one of your ruby instalations (at this
  point 1.8)

 That's all together not necessary.  I suspect all of my development
 systems have two ruby installs.  I ignore the one that came with the
 system and install my own whereever I want.  I update my bashrc so it
 knows about my intentions and that's about it.

The problem here is that's not what happened. Rather than using bashrc
etc.. to put one install of ruby ahead of the other, ruby1.9 was
renamed  to ruby without gem1.9 being renamed to gem (and similarly
for all other ruby related binaries (eg irb))

Fred

 --
 Greg Donaldhttp://destiney.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-talk@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: Authentication plugins

2009-03-20 Thread Fernando Perez

Bob Martens wrote:
 Restful Authentication and I think there is some movement behind
 Authlogic as well. Someone please correct me if I have that wrong.
 
 However, I think there is some merit in actually sitting down and
 rolling your own as well. If anything, it allows you to learn a little
 bit more about Rails and how authentication works as well. A win-win
 in my estimation.

What's cool is that restful_auth is getting back in business after 
having been idle for a long time.

I'm not sure you'll learn much about Rails and Ruby by coding your own 
authentication system, and it won't have 10% of the features offered by 
restful_auth.

By the way looking at plugins code is also a good way of learning ruby 
idioms and stuff about Rails.
-- 
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-talk@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: Authentication plugins

2009-03-20 Thread Wolas!

having used both, i suggest authlogic. It has been easier for me to
put in (and take out) than rest_auth, which is quite a big plugin and
fills your user class. then again, im sure both have their pros and
cons

On Mar 20, 11:18 am, denzy den...@gmail.com wrote:
 Here I was found detail tutorial for autenthication
 (restful_authentication):

 http://railsforum.com/viewtopic.php?id=14216

 On Mar 20, 7:03 am, ricardonns ricardo...@gmail.com wrote:

  Hey there.

  I am starting a new development and am still a newbie in rails, so i'd
  like to ask witch authentication plugin do you sugest?

  Regards,
  Ricardo
--~--~-~--~~~---~--~~
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-talk@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] acceptance test parameters

2009-03-20 Thread Lune Lune

Hi,

I wrote an acceptance test (using selenium) to test a specific product.
But I would like to specify to my test the id of the product to test.

I run my test with the command rake test:acceptance my_test.rsel

I tried the following syntax : rake test:acceptance my_test.rsel 1 for
the id #1 but it doesn't work.


How can I do??

Thanks
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@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: NoMethodError (undefined method `call' for nil:NilClass):

2009-03-20 Thread Wolas!

it would be a good idea to post the controller method update and the
class Model.

On Mar 20, 9:45 am, Jigu wadiaj...@gmail.com wrote:
 I am getting HTTP 500 Internal server error when updating info for one
 of page of my website. Please help me and for your reference i have
 posted ruby trace below:

 Processing ModelsController#update (for 203.187.233.94 at 2009-03-20
 02:40:06) [PUT]
   Session ID:
 BAh7CDoMY3NyZl9pZCIlYTc0NDc5OWI1ZDNhMDM4YmVjZTY0YjE3NGZkODQ2
 YjAiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh
 c2h7AAY6CkB1c2VkewA6DHVzZXJfaWRpBw==--0cc7b78313f817b2be3cc19a19164dbfa9a351e9
   Parameters: {commit=Update, action=update,
 _method=put,
 authenticity_token=47bc4f13abf32c82e7602e1ebd52f5a5338a566d,
 id=12, controller=admin/models, model={city=Surat,
 biography=, measurements=, weight=110,
 agency_rep_email=, agency_address=, country_id=1,
 approved=0, agency_name=, region_id=1, sex=m,
 agency_rep_name=, height=5'3, first_name=Jignesh,
 agency_phone=, eye_color_id=3, hair_color_id=9,
 age=30, last_name=Wadia}}

 NoMethodError (undefined method `call' for nil:NilClass):
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/mime_responds.rb:156:in `respond'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/mime_responds.rb:154:in `each'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/mime_responds.rb:154:in `respond'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/mime_responds.rb:107:in `respond_to'
     /app/controllers/admin/models_controller.rb:64:in `update'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/base.rb:1162:in `send'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/base.rb:1162:in `perform_action_without_filters'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/filters.rb:580:in `call_filters'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/filters.rb:573:in `perform_action_without_benchmark'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/benchmarking.rb:68:in
 `perform_action_without_rescue'
     /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/benchmarking.rb:68:in
 `perform_action_without_rescue'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/rescue.rb:201:in `perform_action_without_caching'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/caching/sql_cache.rb:13:in `perform_action'
     /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/
 active_record/connection_adapters/abstract/query_cache.rb:33:in
 `cache'
     /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/
 active_record/query_cache.rb:8:in `cache'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/caching/sql_cache.rb:12:in `perform_action'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/base.rb:529:in `send'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/base.rb:529:in `process_without_filters'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/filters.rb:569:in
 `process_without_session_management_support'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/session_management.rb:130:in `process'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/base.rb:389:in `process'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/dispatcher.rb:149:in `handle_request'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/dispatcher.rb:107:in `dispatch'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/dispatcher.rb:104:in `synchronize'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/dispatcher.rb:104:in `dispatch'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/dispatcher.rb:120:in `dispatch_cgi'
     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/
 action_controller/dispatcher.rb:35:in `dispatch'
     /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
 103:in `process_request'
     /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
 153:in `with_signal_handler'
     /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
 101:in `process_request'
     /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/fcgi_handler.rb:
 78:in `process_each_request'
     /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in
 `each_cgi'
     /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in
 `each'
     /usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in
 `each_cgi'
     

[Rails] Re: Authentication plugins

2009-03-20 Thread denzy

Here I was found detail tutorial for autenthication
(restful_authentication):

http://railsforum.com/viewtopic.php?id=14216

On Mar 20, 7:03 am, ricardonns ricardo...@gmail.com wrote:
 Hey there.

 I am starting a new development and am still a newbie in rails, so i'd
 like to ask witch authentication plugin do you sugest?

 Regards,
 Ricardo

--~--~-~--~~~---~--~~
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-talk@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: Redirecting to another controller, with a POST method

2009-03-20 Thread Vahagn Hayrapetyan

Fernando Perez wrote:
 Hi,
 
 You cannot redirect with a POST method, so you'll have to find a trick 
 to circumvent that issue.

Right!

Cheers, Vahagn
-- 
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-talk@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: NoMethodError (undefined method `call' for nil:NilClass):

2009-03-20 Thread Jignesh Wadia

Wolas! wrote:
 it would be a good idea to post the controller method update and the
 class Model.

But how can I fix that error message? Database information is updating 
properly but page is redirecting to HTTP 500 Internal server error page 
and I am unable to fix this error. Please help me how can i fix it. I am 
using code below to be updating model entry... and same code works 
properly for other modules.

  # PUT /models/1
  # PUT /models/1.xml
  def update
@model = Model.find(params[:id], :include=:user)

respond_to do |format|
  if @model.update_attributes(params[:model])
@model.user.roles.clear
  @model.user.roles  Role.find_or_create_by_name(model)
#flash[:notice] = Model was successfully updated.
#format.html { redirect_to([:admin, @model]) }
#format.xml  { head :ok }
  else
format.html { render :action = edit }
format.xml  { render :xml = @model.errors, :status = 
:unprocessable_entity }
  end
end
  end



-- 
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-talk@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: Charts in Rails

2009-03-20 Thread Harold

There's plenty out there, Fusion charts free and open flash charts
being my top choices.
This InfoQ article includes Fusion Charts in their comparison:
http://www.infoq.com/articles/sharma-charts-in-rails

Open Flash Charts:
http://teethgrinder.co.uk/open-flash-chart/
http://www.pullmonkey.com/projects/open_flash_chart2


On Mar 20, 3:49 am, motine mot...@gmail.com wrote:
 gnuplot doesn't really look nice and the flash / js / css solutions do
 not really fit my requirement of creating charts on the server side.
 I found Eastwood (http://www.jfree.org/eastwood/) which emulates
 Google Charts but you may run it on your own server. This is quite a
 good solution, but I do not really like the idear of having to run a
 servlet container.

 any further idears?
--~--~-~--~~~---~--~~
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-talk@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] Sending emails on user specific scheduled times

2009-03-20 Thread Intern ruby

Hello,

I am building an application in which I have to send recurring emails
and I am using actionmailer to send one time emails and it is working
fine. Now, I need to set up user specific dates/time and mails should be
send at those times. Does any body have any idea of how should I do it ?
I am not able to understand how to setup cron jobs from ruby
application. Any help would be appreciated.

Thanks.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@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: acceptance test parameters

2009-03-20 Thread Lune Lune

Phlip wrote:
 Lune Lune wrote:
 
 I wrote an acceptance test (using selenium) to test a specific product.
 But I would like to specify to my test the id of the product to test.
 
 Firstly, a test that requires input is not a test, it is a script or
 utility. A true test would work from a list of products and test all 
 of them,
 unattended.
 
 That said, understand that rake is a program that runs programs, so it 
 does not
 pass arguments to them by default. I think there's a system for that, 
 but this
 always works on make-style programs:
 
rake PRODUCT=1 test:acceptance ...
 
 Then access the PRODUCT inside the test with ENV['PRODUCT'].

You perfectly understand what I want to do. but it says that 
ENV['PRODUCT'] is nil

-- 
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-talk@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] hosting with aptana - opinions?

2009-03-20 Thread Paul Reitz

Has anyone tried hosting with aptana? How good is their service? Is it
really that easy to deploy from the IDE? I just wanted to get some
opinions before I tried it out. Thnx :)
-- 
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-talk@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] Reporting with Rails

2009-03-20 Thread Fidel Viegas

Hi all,

I was wondering how you guys generate reports from rails. I want to
generate business reports in pdf format, and was wondering what you
guys use. I have searched the web and found Ruport, but there isn't
much documentation or examples of real world business reports like
jasperreports, for instance. Is it possible to generate good looking
business reports with ruport? What other report generation plugis are
there for rails?

Thanks in advance,

Fidel.

--~--~-~--~~~---~--~~
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-talk@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: Authentication plugins

2009-03-20 Thread Charles Johnson
On Thu, Mar 19, 2009 at 7:03 PM, ricardonns ricardo...@gmail.com wrote:


 Hey there.

 I am starting a new development and am still a newbie in rails, so i'd
 like to ask witch authentication plugin do you sugest?

 Regards,
 Ricardo


I use authlogic because I found it a bit easier for me to understand and
control. There are on the whole fewer modifications to the class or classes
of log-in users than restful_auth provides.

Cheers--

Charles

--~--~-~--~~~---~--~~
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-talk@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] Compact forms

2009-03-20 Thread Fresh Mix

Is there some plugin or helper to do something like this:

http://www.alistapart.com/articles/makingcompactformsmoreaccessible/
-- 
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-talk@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: Converting Array to String in a model using before filte

2009-03-20 Thread Robert Walker

vimal wrote:
 So, is there anyother way to carry this out of the box

I'm not sure precisely what you're trying to accomplish here, but from 
what I can tell it would probably be a lot simpler and more flexible to 
use the built-in serialization provided by ActiveRecord:

--
serialize(attr_name, class_name = Object)

If you have an attribute that needs to be saved to the database as an 
object, and retrieved as the same object, then specify the name of that 
attribute using this method and it will be handled automatically. The 
serialization is done through YAML. If class_name is specified, the 
serialized object must be of that class on retrieval or 
SerializationTypeMismatch will be raised.

Parameters:
attr_name - The field name that should be serialized.
class_name - Optional, class name that the object type should be equal 
to.
Example

  # Serialize a preferences attribute
  class User
serialize :preferences
  end
--

Using this technique you can save you Array object to a string field and 
get back an Array object automatically. All you have to do is add the 
serialize line in your model as shown above.
-- 
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-talk@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: Authentication plugins

2009-03-20 Thread Lee Smith

Definitely recommend Authlogic.  Restful_auth is a generator...and those 
just aren't cool anymore.
-- 
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-talk@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 2.3 Upgrade Issue with MemCache

2009-03-20 Thread TomRossi7

One of the plugins I use is Workling.  It throws the following error
when I try to run it under 2.3:

/Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/
dependencies.rb:443:in `load_missing_constant': uninitialized constant
MemCache (NameError)

The offending line is:

  @@memcache_client_class ||= ::MemCache

I don't know a lot about memcache, so I'm not sure what changed with
2.3 that could cause the error.  Anyone have some ideas?

Thanks!
Tom
--~--~-~--~~~---~--~~
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-talk@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: Sending emails on user specific scheduled times

2009-03-20 Thread Lee Smith

What about Rufus Scheduler?

http://www.railsinside.com/misc/234-scheduler-simple-task-scheduling-from-rails-apps.html
-- 
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-talk@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: NoMethodError (undefined method `call' for nil:NilClass):

2009-03-20 Thread Frederick Cheung



On Mar 20, 12:00 pm, Jignesh Wadia rails-mailing-l...@andreas-s.net
wrote:
 But how can I fix that error message? Database information is updating
 properly but page is redirecting to HTTP 500 Internal server error page
 and I am unable to fix this error. Please help me how can i fix it. I am
 using code below to be updating model entry... and same code works
 properly for other modules.

   # PUT /models/1
   # PUT /models/1.xml
   def update
     @model = Model.find(params[:id], :include=:user)

     respond_to do |format|
       if @model.update_attributes(params[:model])
         @model.user.roles.clear
   @model.user.roles  Role.find_or_create_by_name(model)
         #flash[:notice] = Model was successfully updated.
         #format.html { redirect_to([:admin, @model]) }
         #format.xml  { head :ok }

in this branch you're not telling rails what to do - you've commented
out all your format.bla calls

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-talk@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: Authentication plugins

2009-03-20 Thread ricardonns

I've already took a look into authlogic.

Seeming pretty cool so far... Gonna check it better and test it.

Restful Authentication i've lost myself in the middle of it. Seems
more complete, but also more complicated, and for what i need
authlogic should work just fine.

Thanks to all.
--~--~-~--~~~---~--~~
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-talk@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] Display XML as text

2009-03-20 Thread Sudhi Kulkarni

I have question regarding render :text ... I read the conten of XML file
and display it using render :text ... but the content only is shown and
not the entire xml file ... How do I get the xml file display as xml
file in the output?


to state with an example the problem I have if the xml is
animaldog/animal and I use render :text then output is only dog... I
want to output entire animaldog/animal

Need help

Regards,
Sudhindra
-- 
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-talk@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: activerecord-jdbc-adapter 0.9 oracle number id problem

2009-03-20 Thread Sylvain

Hello Nick,
I experience the same bug described by Mark with version 0.9.1, so I
guess he did not file a bug report in Jira.
Can you please confirm, so I open a bug ?
One last question, when do you plan to release a 0.9.2 version ?

Thanks again for your time and your work you give to the ruby and
rails community.

  Sylvain

On Mar 4, 5:27 am, Nick Sieger nicksie...@gmail.com wrote:
 On Tue, Mar 3, 2009 at 1:40 PM, Mark Becker



 rails-mailing-l...@andreas-s.net wrote:

  I'm having a problem using jruby on rails with a legacyoracledatabase
  (OracleDatabase 10g Enterprise Edition Release 10.1.0.3.0).  Theoracle
  number primary key is getting converted into a decimal, which is causing
  restful style URIs not to work.  For example I'm seeing URIs like
 http://localhost:3000/members/show/7201.0?tab=nameswhere the id should
  be an integer, not a double, and they result in Missing template
  errors.

  A friend of mine said that the same problem arose for him when he
  updated fromactiverecord-jdbc-adapterversion 0.8 to version 0.9, which
  is what I'm using.  Is this a known issue?  Is there a workaround short
  of changing the database to use integer primary keys? That isn't an
  option for us.

  Here's my configuration:

  jruby 1.1.6 (ruby 1.8.6 patchlevel 114) (2008-12-17 rev 8388)
  [amd64-java]
  rails (2.2.2)
 activerecord(2.2.2)
 activerecord-jdbc-adapter(0.9)

 If you could file a bug [1] and provide a short test case, we'll try
 to have this fixed for 0.9.1, due out in a week or two. In your
 example/test case, please be sure to provide the schema or migration
 that you use to create the table.

 Thanks,
 /Nick

 [1]:http://kenai.com/jira/browse/ACTIVERECORD_JDBC

--~--~-~--~~~---~--~~
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-talk@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: Authentication plugins

2009-03-20 Thread Railsmaniac

Yeap. I've migrated to authlogic.

You should also try clearance, 
http://github.com/thoughtbot/clearance/tree/master

On Mar 20, 4:33 pm, Lee Smith rails-mailing-l...@andreas-s.net
wrote:
 Definitely recommend Authlogic.  Restful_auth is a generator...and those
 just aren't cool anymore.
 --
 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-talk@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: Initializers and I18n

2009-03-20 Thread Daniel Lopes

somebody?

On 19 mar, 22:09, Daniel Lopes danielvlo...@gmail.com wrote:
 Hello,

 My project have strange behavior diferent than I expected.

 If I place a line like below after the Rails::Initializer block from
 my enviroment file it will work fine:

 PROJECT_NAME = I18n.t(settings.name)

 But If I move this to a initializer file it will get the translation
 error:

 translation missing: xxx, xxx 

 I'm sure this is happening because the order of Rails load the
 framework, initializers and then locale.

 But somebody know if is possible to puts this in initializer and make
 that kind of constant assignments after Rails load the locale?

 I'm thinking in include a module after Rails::Initializer.run but for
 that kind of thing need to be in a initializer file.
--~--~-~--~~~---~--~~
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-talk@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] drake vs the standard Rails Rakefile

2009-03-20 Thread Phlip

Railsters:

I tried to stop them, but my colleagues have added way too many unit tests to 
our projects.

Because we are underusing our multi-core CPUs, I would like to speed the test 
run up by soaking the unit tests in one thread and the functional tests in 
another.

drake is a rake clone which offers the seq[:task1, :task2] command, to run the 
two tasks in two cores.

Has anyone tried this with the standard Rails Rakefile? and would like to share 
some scripts? that maybe show how to keep the database happy?

I will post back here what I discover while trying to do this!

-- 
   Phlip


--~--~-~--~~~---~--~~
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-talk@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: Display XML as text

2009-03-20 Thread Hubert Łępicki

Hi,

are you sure that this is real output? Try using wget or curl to see
what real output is. Or maybe look into page source? (Ctrl + V on
firefox). It might be that your browser is not displaying xml tags
just ignoring them, and displays only what's inside.

Best,
H

On 20 Mar, 15:44, Sudhi Kulkarni rails-mailing-l...@andreas-s.net
wrote:
 I have question regarding render :text ... I read the conten of XML file
 and display it using render :text ... but the content only is shown and
 not the entire xml file ... How do I get the xml file display as xml
 file in the output?

 to state with an example the problem I have if the xml is
 animaldog/animal and I use render :text then output is only dog... I
 want to output entire animaldog/animal

 Need help

 Regards,
 Sudhindra
 --
 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-talk@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: Compact forms

2009-03-20 Thread Hubert Łępicki

none which I know. Can't you just follow instructions on the blog -
looks like nothing too much complicated.

On 20 Mar, 14:12, Fresh Mix rails-mailing-l...@andreas-s.net wrote:
 Is there some plugin or helper to do something like this:

 http://www.alistapart.com/articles/makingcompactformsmoreaccessible/
 --
 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-talk@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: Form Validation Question, and a GeoKit Question

2009-03-20 Thread Jason Green

Thanks for that, nice little method, this is what I put in:

acts_as_mappable

  validates_numericality_of :lat, :lng

  before_validation_on_create :generate_geocode

  private
  def generate_geocode
address = [self.street, self.city, self.location_state, 
self.postcode, self.country].join(', ')
geoloc = GeoKit::Geocoders::MultiGeocoder.geocode(address)
errors.add_to_base('Could not geocode address') unless 
geoloc.success
self.lat, self.lng = geoloc.lat, geoloc.lng
  end
-- 
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-talk@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] Ruby/Rails projects market site - anyone?

2009-03-20 Thread Hubert Łępicki

Hi guys,

I was wondering how do you look for clients for your Rails companies?
I know there are places like project4hire.com but these are more
suitable for individuals I think than companies.

I was supprised to find there is no such project market for Rails
projects out there - anyone interested in developing one? Do you think
it might be useful / got interest of both developers and clients?

Thanks and looking forward to hear your opinion.
--~--~-~--~~~---~--~~
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-talk@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: Reporting with Rails

2009-03-20 Thread Peter De Berdt

On 20 Mar 2009, at 13:42, Fidel Viegas wrote:

 I was wondering how you guys generate reports from rails. I want to
 generate business reports in pdf format, and was wondering what you
 guys use. I have searched the web and found Ruport, but there isn't
 much documentation or examples of real world business reports like
 jasperreports, for instance. Is it possible to generate good looking
 business reports with ruport? What other report generation plugis are
 there for rails?

If price is not an issue, you could use PrinceXML to generate PDFs  
from XHTML+CSS. The result is great.

http://www.intridea.com/2007/12/20/announcing-princely-rails-prince-xml-pdf-wrapper?blog=company
http://github.com/mbleigh/princely/tree/master


Best regards

Peter De Berdt


--~--~-~--~~~---~--~~
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-talk@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: Reporting with Rails

2009-03-20 Thread Fidel Viegas

HI Peter,

Thanks for the reply.

I have had a look at the link, and it is quite an interesting product.
I don't really mind if it is commercial or free, but what I am after
is something like an API as opposed to a third-party software that I
call from ruby.

But, I will give it a try and see how it works.

Thanks once again.

Fidel.

On Fri, Mar 20, 2009 at 4:33 PM, Peter De Berdt
peter.de.be...@pandora.be wrote:

 On 20 Mar 2009, at 13:42, Fidel Viegas wrote:

 I was wondering how you guys generate reports from rails. I want to
 generate business reports in pdf format, and was wondering what you
 guys use. I have searched the web and found Ruport, but there isn't
 much documentation or examples of real world business reports like
 jasperreports, for instance. Is it possible to generate good looking
 business reports with ruport? What other report generation plugis are
 there for rails?

 If price is not an issue, you could use PrinceXML to generate PDFs from
 XHTML+CSS. The result is great.
 http://www.intridea.com/2007/12/20/announcing-princely-rails-prince-xml-pdf-wrapper?blog=company
 http://github.com/mbleigh/princely/tree/master

 Best regards

 Peter De Berdt

 


--~--~-~--~~~---~--~~
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-talk@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] debugger seems broken with Rails 2.3.2

2009-03-20 Thread Fernando Perez

With Rails 2.3.2 and ruby-debug 0.10.3 very weird things are happening.
Am I the only one?
-- 
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-talk@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: Reporting with Rails

2009-03-20 Thread Lee Smith

Prawn and Prawnto combo offer some nice PDF generation functionality as 
well.

http://railscasts.com/episodes/153-pdfs-with-prawn
http://prawn.majesticseacreature.com/
http://www.cracklabs.com/prawnto
-- 
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-talk@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] rfm working in localhost but not in production enviromen

2009-03-20 Thread elioncho

Hi Guys,

We've been using RFM to sync to a FMP server. As we were deploying the
app to the production server, we encountered a small problem in this
part of the code:


In enviroment.rb:

SERVER_CONFIG = {
 :host = my.ip.number,
 :account_name = user,
 :password = pass
}
DATABASE = my_database

In the controller I have this:
if(Rfm::Server.new(SERVER_CONFIG)[DATABASE][template].find
({user_id = current_user.id})[0] != nil)
puts the user do exist
else
puts the user does not exist
end



When working in localhost the sync works fine, but when I have the
Rails Application is on the production server(hosted at slicehost with
ubuntu on it) it shows this error in the if() line:

NoMethodError: You have a nil object when you didn't expect it! The
error occurred while evaluating nil.record_entity_expansion

We are not sure if this is a server permission problem or a config
thing. Any help would be greatly appreciated.
--~--~-~--~~~---~--~~
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-talk@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: Display XML as text

2009-03-20 Thread Hassan Schroeder

On Fri, Mar 20, 2009 at 7:44 AM, Sudhi Kulkarni
rails-mailing-l...@andreas-s.net wrote:

 to state with an example the problem I have if the xml is
 animaldog/animal and I use render :text then output is only dog... I
 want to output entire animaldog/animal

You need to escape the angle brackets, e.g.

% @xml = animaldog/animal %

%=h @xml %

Try the above with and without the 'h'.

-- 
Hassan Schroeder  hassan.schroe...@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-talk@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: Display XML as text

2009-03-20 Thread Sheryl Barrow
Why don't you use the render :xml?

Rendering XML

Rendering XML sets the content type to application/xml.

  # Renders 'nameDavid/name'
  render :xml = {:name = David}.to_xml

 It‘s not necessary to
callhttp://api.rubyonrails.org/classes/ActionController/Base.html#M000612
to_xml on the object you want to
renderhttp://api.rubyonrails.org/classes/ActionController/Base.html#M000633,
since 
renderhttp://api.rubyonrails.org/classes/ActionController/Base.html#M000633will
automatically do that for you:

  # Also renders 'nameDavid/name'
  render :xml = {:name = David}



On Fri, Mar 20, 2009 at 12:07 PM, Hassan Schroeder 
hassan.schroe...@gmail.com wrote:


 On Fri, Mar 20, 2009 at 7:44 AM, Sudhi Kulkarni
 rails-mailing-l...@andreas-s.net wrote:

  to state with an example the problem I have if the xml is
  animaldog/animal and I use render :text then output is only dog... I
  want to output entire animaldog/animal

 You need to escape the angle brackets, e.g.

 % @xml = animaldog/animal %

 %=h @xml %

 Try the above with and without the 'h'.

 --
 Hassan Schroeder  hassan.schroe...@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-talk@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 parameter to url

2009-03-20 Thread Fresh Mix

If url is http://mydomain.com/blog/tags

How can I make a link, that add parameter to url?

Ex: http://mydomain.com/blog/tags?locale=de

And not a: http://mydomain.com/?locale=de


%= link_to My link, :locale = 'de' % Remove blog/tags from url.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby 
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@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] ActiveRecord: Using include with conditions

2009-03-20 Thread Sharagoz --

Three models: Product, Image, Document
Relations: A product has many images and documents.
Images and products has a flag telling whether or not they are
published.

I want to show a product and include only documents and images that are
published.

I was hoping I could do this in my controller:
@product = Product.find(params[:id], :include = [:images, :documents],
:conditions = '(images.published=1 AND documents.published=1')

That worked great as long as the product had at least one published
image and at least one published document. If not, I would get a
recordnotfound exception.

What I'm currently doing is this:
@product = Product.find(params[:id], :include = [:images, :documents])
@product.documents.delete_if{|d| d.published == false}
@product.images.delete_if{|i| i.published == false}

This works but I'm curious if the original query can be modified to
handle cases where a product doesnt have at least one published image
and document. Can it?


-S
-- 
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-talk@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: Google Latitude in Ruby on Rails

2009-03-20 Thread saideep annadatha
Hello,
Its like in the application we have built, we wanted to show markups on
googlemaps of the users of our site according to their city. And so, while
saving the place, we have also got the Latitude and Longitude with help of
Google Maps API and saved in the database.

And while rendering the view it we used the data from the db and with js
code (available to show the gmaps) we have marked the users.

Regards,
Saideep Annadatha

On Thu, Mar 19, 2009 at 11:45 AM, Angappan Ayyavoo 
rails-mailing-l...@andreas-s.net wrote:


 saideep annadatha wrote:
  How would you want to use the latitude?
 
  Previously, we have calculated the latitude and longitude with
  Javascript
  functions according to the place given and stored the values in a
  database.
 
  So, what is it exactly are you trying to do?
 
  On Tue, Mar 17, 2009 at 4:11 PM, Angappan Ayyavoo 
  rails-mailing-l...@andreas-s.net wrote:
 
  Thanks
  Angaps
  --
  Posted via http://www.ruby-forum.com/.
 
  
 
 
 
  --
  Thank You,
  Saideep Annadatha





 Hai

 Thanks for your reply.

  I want to use the google latitude in my rails application.

  www.google.com/ig


  It is one of the widget which has the map+twitter application to share
 our resources to others in our link and vice versa.


  kindly tell me any idea on this.

 thanks
 angaps





















 --
 Posted via http://www.ruby-forum.com/.

 



-- 
Thank You,
Saideep Annadatha

--~--~-~--~~~---~--~~
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-talk@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: LDAP Authentication Failed

2009-03-20 Thread Jeff Lewis

Hi Palani,

If you're trying to auth against ldap using Net::LDAP, might want to
try:

  ...
  require 'net/ldap'

  LDAP_HOST = '127.0.0.1'  # or match your setup.
  LDAP_PORT = 389  # or ...
  LDAP_DN = 'cn=shalini,ou=people,dc=mips,dc=com'  # or ...
  ...
  def ldap_auth(uid, pss)
return false if uid.blank? || pss.blank?
clean_uid = uid.gsub(/[^a-zA-Z0-9._-]+/, '')  # or ..., to guard
against ldap-injection.
usr = uid=#{clean_uid},#{LDAP_DN}
ldap = Net::LDAP.new({:host=LDAP_HOST, :port=LDAP_PORT, :auth=
{:method=:simple, :username=usr, :password=pss}})
return ldap.bind  # returns true if successfully auth'd; false if
not.
  end
  ...

Jeff

On Mar 19, 1:44 am, Palani Kumar rails-mailing-l...@andreas-s.net
wrote:
 Hi,

       I have installed  openLDAP on windows vista. i correctly configure
 the openLDAP server. when i do the ladpadd ldap search by using the
 following commands

 Commands:
    ldapadd -x step1.ldif

    ldapsearch -D cn=shalini,dc=mips,dc=com -w serverpwd  -b
 cn=shalini,ou=people,dc=mips,dc=com

 It shows the output like:

 # extended LDIF
 #
 # LDAPv3
 # base cn=shalini,ou=people,dc=mips,dc=com with scope sub
 # filter: (objectclass=*)
 # requesting: ALL
 #

 # shalini, people, mips.com
 dn: cn=shalini,ou=people,dc=mips,dc=com
 objectClass: inetOrgPerson
 cn: shalini
 cn: Robert J Smith
 cn: bob  smith
 sn: shalini
 uid:: c2hhbGluaQk=
 userPassword:: c2hhbGluaSA=
 carLicense: HISCAR 123
 homePhone: 555-111-
 mail: palani@gmail.com
 mail: rsm...@example.com
 mail: bob.sm...@example.com
 description: swell guy
 ou: Human Resources

 # search result
 search: 2
 result: 0 Success

 # numResponses: 2
 # numEntries: 1

  so from this output i guess i correctly created the Directory service
 on openLDAP server. The error i faced is as follows. I opened the
 script/console
 and type the following commands require 'net/ldap'
 []
 ldap=Net::LDAP.new

 =#Net::LDAP:0io5bcpoi
 @auth={:method=:anonymous},@port=389,@encryption=nil,@host=127.0.0.1,@verb 
 ose=false,@base=dc=com,@openconnection=nil)ldap.auth(shal...@mips.com,shalini)

 = {:password =shalini,:username =shal...@mips.com,:method
 =simple}

 ldap.bind

 false

 so what i miss here?  can anyone please help me to solve this problems.
 --
 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-talk@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] 4 Rails apps using the same table. How to streamline?

2009-03-20 Thread LaughingNinja

Hi,

I have 4 apps using similar User tables(3 open source projects and one
in-house app). I'm trying to merge into one shared database User table
(external to all 4 apps).

--
I'm using the following code in the User model to switch to the shared
database:

class User  ActiveRecord::Base

  # GSL, 03/18/09 - Add reference to external ua database.
  User.establish_connection (
  :adapter  = mysql,
  :host = example.corp.example.com,
  :username = root,
  :password = ?,
  :database = ua_production
)
--
Then, I have to switch the other models back:
class Attachment  ActiveRecord::Base

  # GSL, 03/18/09 - Add reference to external ua database.
  Attachment.establish_connection (
  :adapter  = mysql,
  :host = example.corp.example.com,
  :username = root,
  :password = ?,
  :database = redmine
)

--
I added the above to all the other models in my Redmine app.

So, now the views that are trying to do a SQL JOIN are bombing.

Is  there an easier way?

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-talk@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: GMap popups

2009-03-20 Thread saideep annadatha
Hi,
 This site would be the best reference ever
http://code.google.com/apis/maps/documentation/reference.html

Regards,
Saideep Annadatha

On Thu, Mar 19, 2009 at 6:29 PM, railsb...@gmail.com railsb...@gmail.comwrote:


 Hello there,

  I am working with GMap in my rails application. I am getting
 default pop up Marker.(orange color balloon type) how can I get
 different types of pop ups.

  Can anybody help me regarding this problem

 Thanks in advance.

 Rails Developer.
 



-- 
Thank You,
Saideep Annadatha

--~--~-~--~~~---~--~~
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-talk@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 parameter to url

2009-03-20 Thread Freddy Andersen

%= link_to Link, blog_path(:locale = de) %

or

%= link_to Link, :controller = blog, :action = show, :locale
= de %


--~--~-~--~~~---~--~~
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-talk@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] Instance variables in helpers?

2009-03-20 Thread Lee D'oéjgi
Hi,

Can someone tell me why the following isn't setting an instance variable?
Perhaps they can't be set/used in helpers? I have a revision_info method in
ApplicationHelper that returns the current SVN revision number (used for
debugging info in the footer):

module ApplicationHelper
  def revision_info
logger.info(In revision_info(); rev...@rev}) # @rev is always nil
if (@rev ||= (capistrano_revision_info || svn_revision_info)).blank?
  return nil
else
  return 'Revision ' + @rev
end
  end
end

# capistrano_revision_info returns the revision number from the REVISION
file
# capistrano_revision_info returns the revision number from `svn info --xml`

Thanks in advance for any replies.

Cheers,
  Lee

--~--~-~--~~~---~--~~
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-talk@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] Slightly OT: Search for your questions/comments to forum

2009-03-20 Thread Kedar Mhaswade

Sorry if this is rather stupid. I tried doing the due diligence, but
could not get an answer.

How do you search ruby-forum for your own entries (posts) made? For
example, I was looking for a question I had asked related to something
and I can't find it now.

-Kedar
-- 
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-talk@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: Slightly OT: Search for your questions/comments to forum

2009-03-20 Thread Lee Smith

Have you tried going to the google group and viewing your profile?

http://groups.google.com/group/rubyonrails-talk?hl=en
-- 
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-talk@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: IIS deployment

2009-03-20 Thread Lee Smith

Square peg...round hole.
-- 
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-talk@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: IIS deployment

2009-03-20 Thread Colin Law
2009/3/20 mahmoud_cs mahmoudahmedfo...@yahoo.com


  I want to deploy my rails application to remote windows iis server
 what is the basic steps i can do?


I would suggest that the first basic step is to search on google for Deploy
Rails IIS which would turn up loads of useful links.

Much of it will no doubt be out of date but I am sure it will provide some
options.

Unless you are forced into using IIS however I would suggest not doing it at
all.



 


--~--~-~--~~~---~--~~
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-talk@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: Charts in Rails

2009-03-20 Thread Robert Walker

Harold wrote:
 There's plenty out there, Fusion charts free and open flash charts
 being my top choices.

You must have glossed over the OP's requirements. Namely that Flash 
charts were not an option.
-- 
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-talk@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: ActiveRecord: Using include with conditions

2009-03-20 Thread Frederick Cheung


On 20 Mar 2009, at 16:59, Sharagoz -- wrote:


 Three models: Product, Image, Document
 Relations: A product has many images and documents.
 Images and products has a flag telling whether or not they are
 published.

 I want to show a product and include only documents and images that  
 are
 published.

 I was hoping I could do this in my controller:
 @product = Product.find(params[:id], :include =  
 [:images, :documents],
 :conditions = '(images.published=1 AND documents.published=1')

 That worked great as long as the product had at least one published
 image and at least one published document. If not, I would get a
 recordnotfound exception.

 What I'm currently doing is this:
 @product = Product.find(params[:id], :include =  
 [:images, :documents])
 @product.documents.delete_if{|d| d.published == false}
 @product.images.delete_if{|i| i.published == false}

 This works but I'm curious if the original query can be modified to
 handle cases where a product doesnt have at least one published image
 and document. Can it?


When you do a join based include this is what happens: conditions on  
the associations can filter out their parents.

One thing that does work is
Product.find(:all, :include =  
[:published_images, :published_documents])
where those are associations with images  documents with the  
condition that published is true

This stuff tends to be a bit messy though.

Lastly there is very little benefit in eager loading when you only  
have 1 parent record.
Fred




 -S
 -- 
 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-talk@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: Slightly OT: Search for your questions/comments to forum

2009-03-20 Thread Kedar Mhaswade

Thanks! That helps. I was searching at ruby-forum and thought it would
have something similar too.

On Mar 20, 10:46 am, Lee Smith rails-mailing-l...@andreas-s.net
wrote:
 Have you tried going to the google group and viewing your profile?

 http://groups.google.com/group/rubyonrails-talk?hl=en
 --
 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-talk@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] Patchwork: an open-sourced wiki-like microblogging tool

2009-03-20 Thread Yoichi Hirai

Let me announce a new project Patchwork, a microblogging tool.

demo working at: http://patchwork.yohaku.info
code hosted at: http://github.com/pirapira/patchwork/tree/master
(under the MIT license)

The idea:
posts and comments are the same thing.  You can
1. create an original piece of text
2. write below another piece
3. write above another piece
4. create a fork of another piece and edit it.

regards,
Yoichi Hirai

--~--~-~--~~~---~--~~
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-talk@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] actionmailer issues...any experts?

2009-03-20 Thread tony

I have a rails app that can send emails to gmail, yahoo accounts.  But
when it comes to more obscure accounts like emai...@my-app.com or
emai...@blah.edu, the mail never arrives even though the log shows
that
the email was sent.  Any ideas why this may be happening?

I have sent an email directly through the same web server through the
command line using

mail -s and that worked.  Why doesn't it work through my rails app?

here are my configuration settings (mostly default)

# Disable delivery errors, bad email addresses will be ignored
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.perform_deliveries = true
  config.action_mailer.default_charset = utf-8

config.action_mailer.smtp_settings = {
:address = localhost,
:port = 25,
:domain = my-app.com
  }

help please!

thanks
Tony
--~--~-~--~~~---~--~~
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-talk@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] actionmailer issues...any experts?

2009-03-20 Thread tony

I have a rails app that can send emails to gmail, yahoo accounts.  But
when it comes to more obscure accounts like emai...@my-app.com or
emai...@blah.edu, the mail never arrives even though the log shows
that
the email was sent.  Any ideas why this may be happening?

I have sent an email directly through the same web server through the
command line using

mail -s and that worked.  Why doesn't it work through my rails app?

here are my configuration settings (mostly default)

# Disable delivery errors, bad email addresses will be ignored
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.perform_deliveries = true
  config.action_mailer.default_charset = utf-8

config.action_mailer.smtp_settings = {
:address = localhost,
:port = 25,
:domain = my-app.com
  }

help please!

thanks
Tony
--~--~-~--~~~---~--~~
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-talk@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] Getting a Time Zone abbreviation from the full name?

2009-03-20 Thread Danimal

There's got to be an easier way...

I am building an event manager and as part of it, the user selects the
time zone of the event from a drop-down list using the
time_zone_select helper. This is stored in the events table as a
string.

Because of legacy data which is stored in UTC, I want to keep the
dates and times in the table as UTC but when I display it, I want to
show the abbreviated version of the time zone value as selected.

For example, if the user created an event that starts on: 2009-05-01
10:30:00 UTC
and they chose the time zone: Mountain Time (US  Canada)

I want to be able to display it as: May 1st, 2009, 10:30 AM (MST)

What I'm stuck with is: how to easily convert:
Mountain Time (US  Canada) = MST

Shouldn't there be an easy mapping somewhere? Given that I have the
full time zone as a string, I need to pass it into a data structure or
object and then get the abbreviation. So far, the best I've found is
(where myevent.time_zone is the full time zone string):

ActiveSupport::TimeZone::ZONES.find{|z| z.name ==
myevent.time_zone}.tzinfo.current_period.abbreviation.to_s

This returns  MST. But there's gotta be a better way, right? (I just
can't seem to find one)

Anyone?

-Danimal
--~--~-~--~~~---~--~~
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-talk@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: Instance variables in helpers?

2009-03-20 Thread ruby...@ymail.com



On 20 Mar., 18:36, Lee D'oéjgi leedoe...@gmail.com wrote:
 Hi,

 Can someone tell me why the following isn't setting an instance variable?
 Perhaps they can't be set/used in helpers? I have a revision_info method in
 ApplicationHelper that returns the current SVN revision number (used for
 debugging info in the footer):

 module ApplicationHelper
   def revision_info
     logger.info(In revision_info(); rev...@rev}) # @rev is always nil
     if (@rev ||= (capistrano_revision_info || svn_revision_info)).blank?
       return nil
     else
       return 'Revision ' + @rev
     end
   end
 end

 # capistrano_revision_info returns the revision number from the REVISION
 file
 # capistrano_revision_info returns the revision number from `svn info --xml`

 Thanks in advance for any replies.

At least I can tell you that it *is* possible to set instance
variables in helper methods *and* get them when calling the same
helper later on, so the problem must be somewhere else in the code.
Did you try going to the console and check what the two methods
#capistrano_revision_info and #svn_revision_info actually returns?
Maybe that's the problem, I don't know, but it's definitely not the
instance variables.

--
Cheers,
David Knorr
http://twitter.com/rubyguy
--~--~-~--~~~---~--~~
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-talk@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: Authentication plugins

2009-03-20 Thread Chris Warren

I too have had better luck with AuthLogic. For me I think it was not so 
much a matter of the plugin itself, but I found the AuthLogic 
documentation, tutorials, and examples to be easier to follow. YMMV.

-Chris Warren

Wolas! wrote:
 having used both, i suggest authlogic. It has been easier for me to
 put in (and take out) than rest_auth, which is quite a big plugin and
 fills your user class. then again, im sure both have their pros and
 cons

 On Mar 20, 11:18 am, denzy den...@gmail.com wrote:
   
 Here I was found detail tutorial for autenthication
 (restful_authentication):

 http://railsforum.com/viewtopic.php?id=14216

 On Mar 20, 7:03 am, ricardonns ricardo...@gmail.com wrote:

 
 Hey there.
   
 I am starting a new development and am still a newbie in rails, so i'd
 like to ask witch authentication plugin do you sugest?
   
 Regards,
 Ricardo
   
 
   


--~--~-~--~~~---~--~~
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-talk@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: actionmailer issues...any experts?

2009-03-20 Thread Frederick Cheung


On 20 Mar 2009, at 18:16, tony wrote:


 I have a rails app that can send emails to gmail, yahoo accounts.  But
 when it comes to more obscure accounts like emai...@my-app.com or
 emai...@blah.edu, the mail never arrives even though the log shows
 that
 the email was sent.  Any ideas why this may be happening?


Different hosts might be more or less restrictive when it comes to  
spam (eg blacklists of ip ranges, whether they check SPF records etc...)
 I have sent an email directly through the same web server through the
 command line using

 mail -s and that worked.  Why doesn't it work through my rails app?

I know nothing about mail -s. Does it send email through the same smtp  
server as your rails app. Would it set the same return-path/from  
address (which is what matters for SPF) as your rails app ?

Fred

 here are my configuration settings (mostly default)

 # Disable delivery errors, bad email addresses will be ignored
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.perform_deliveries = true
  config.action_mailer.default_charset = utf-8

 config.action_mailer.smtp_settings = {
:address = localhost,
:port = 25,
:domain = my-app.com
  }

 help please!

 thanks
 Tony
 


--~--~-~--~~~---~--~~
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-talk@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: Who are the ROR guru's on this board ?

2009-03-20 Thread Cwi Tech guy

Matt Jones wrote:
 I'm going to assume that you're with CWI Hosting, judging by your
 posted name and a post I found on another webmaster board.
 
 If so, some totally free advice:
 
 - the market for RoR shared hosting is not very good; shared servers
 just don't typically have the capacity to handle Rails sites with any
 notable amount of traffic. Passenger helps, but its still not
 preferred for most apps.
 
 - your ToS doesn't specify how much memory FastCGI processes are
 limited to. As a sometimes-customer of shared hosting, this is a red
 flag. There's almost certainly a limit, and as a potential customer,
 I'd like to know what it is...
 
 - most modern Rails hosting is either managed (EngineYard, for
 example: big $, but awesome support) or VPS (Slicehost being a popular
 example). You might consider adding VPS plans to your lineup.
 
 - finally, on a totally superficial note, whoever thought that
 transparent menus over dark-colored content was a good idea should be
 fired immediately. :) No, seriously - it looks terrible, and is hard
 to read.
 
 --Matt Jones
 
 On Mar 17, 2:38�am, Cwi Tech guy rails-mailing-l...@andreas-s.net

Matt

  The advice is appreciated. CWI is building new servers, and a new 
site, and is wanting feedback from users like you on the new setup and I 
will be posting your feedback to CWI. The setups are based on both 
shared hosting servers and some dedicated servers they have for around 
$85. You seem a discerning consumer, is this something you would be 
interested in ?

-- 
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-talk@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 position cursor on first input field?

2009-03-20 Thread sultan

It must be simple, but I haven't been able to figure it out.
--~--~-~--~~~---~--~~
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-talk@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 position cursor on first input field?

2009-03-20 Thread Philip Hallstrom

 It must be simple, but I haven't been able to figure it out.

If it's the first form this would work:

%= javascript_tag $$('form input[type=text]').first().focus() %

Tweak as necessary to target the form/element in question...

-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-talk@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] Generic link_to in a shared partial

2009-03-20 Thread Bharat Ruparel

I am trying to write a simple and generic one table maintenance shared
partial which can be reused to maintain multiple tables with the
following fields:

id, name, created_by, updated_by.

I am stuck in generating rest route correctly.  Here is an example for a
crust_types table inspired by Ryan Bates Forms screencasts.

Here is the index action from CrustTypeController:

  def index
@crust_types = CrustType.find(:all)
respond_to do |format|
  format.html # index.html.erb
  format.xml  { render :xml = @crust_types }
end
  end

Here is the content of corresponding index.html.erb template:

%= render :partial = 'shared/crud_table', :object = @crust_types,
:locals = {:ll = 'crust_type'} %

Finally, here are the relevant code snippets from _crud_table.html.erb
partial in the shared folder:

  % for a_rec in crud_table %
tr class=%= cycle(odd,even) %
  td class=first%= a_rec.id %/td
  td%= a_rec.name %/td
  td%= a_rec.created_at %/td
  td%= a_rec.updated_at %/td
  td%= link_to 'Show', #{ll}_path % | %= link_to 'Edit',
edit_#{ll}_path(#{ll}) % | %= link_to 'Destroy', #{ll}_path ,
:confirm = 'Are you sure?', :method = :delete %/td
/tr
  % end %

The rest paths for link_to methods are not being evaluated they are
literally output.  For example: I want the link_to 'Edit',
edit_#{ll}_path(#{ll}) method to generate the correct edit path as
'/crust_types/1/edit for the first record, instead, I get
'/edit_crust_type_path(crust_type)'.  Clearly, it is not being
evaluated.  How should I do it?

Thanks in advance for your time.

Bharat
-- 
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-talk@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: Charts in Rails

2009-03-20 Thread Harold A . Giménez Ch .
 You must have glossed over the OP's requirements
indeed I did. My apologies.

On Fri, Mar 20, 2009 at 1:58 PM, Robert Walker 
rails-mailing-l...@andreas-s.net wrote:


 Harold wrote:
  There's plenty out there, Fusion charts free and open flash charts
  being my top choices.

 You must have glossed over the OP's requirements. Namely that Flash
 charts were not an option.
 --
 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-talk@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 requires RubyGems = 1.3.1 (you have 1.1.1) on OSX

2009-03-20 Thread Andre In la

Hi, I just installed rails 2.3.2 and after

rails test
cd test
rake db:migrate
mongrel_rails start

I get this:

** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Rails requires RubyGems = 1.3.1 (you have 1.1.1). Please `gem update
--system` and try again.

gem -v = 1.3.1


Any ideas for a solution? Is it possible I have more than one
installation of ruby on my machine, with mongrel accessing the other
one? How do I find out and how do I resolve this?

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-talk@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 2.3 and helpers within plugins

2009-03-20 Thread acras

Hi,

  I'm porting a plugin of mine to work with rails 2.3. My plugin is
based in engines.
  I'm doing good so far, the only problem is with helpers. Rails seems
not to recognize helpers from my plugin.

Anyone ran into this issue?
--~--~-~--~~~---~--~~
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-talk@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 2.3 and helpers within plugins

2009-03-20 Thread acras

I'm starting to get it. Engines Plugin did some kind of generic
include, making the helpers within a plugin to be available within the
app.
My question now is: how can I do it the best way?

On 20 mar, 17:18, acras ricardo.ac...@gmail.com wrote:
 Hi,

   I'm porting a plugin of mine to work with rails 2.3. My plugin is
 based in engines.
   I'm doing good so far, the only problem is with helpers. Rails seems
 not to recognize helpers from my plugin.

 Anyone ran into this issue?
--~--~-~--~~~---~--~~
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-talk@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: Stop rendering a response in the default layout

2009-03-20 Thread ruby...@ymail.com



On 17 Mar., 19:39, tashfeen.ekram tashfeen.ek...@gmail.com wrote:
 here is specifically what i get in my firefox debug window:

 syntax error
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN\n

 On Mar 17, 1:52 pm, tashfeen.ekram tashfeen.ek...@gmail.com wrote:



  here is the js that i am using for the request. does it not make a js
  request?http://pastie.org/418937

  here is my controller:

 http://pastie.org/418941

  then i am using create.js.erb for the response...

Well, if you are sure that:

1) You have correctly named the view create.js.erb
2) You don't have a layout called something like application.js.erb

... I have really have no clue what's going on here. I suggest you try
to upgrade the application to the latest version of Rails, and if that
doesn't fix it, I'ld be more than happy if you zipped the app and
uploaded it somewhere, so I could take a closer look.

--
Cheers,
David Knorr
http://twitter.com/rubyguy
--~--~-~--~~~---~--~~
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-talk@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] When are activerecord associations made?

2009-03-20 Thread Christopher Lee

Hello,

My question is when ActiveRecord associations are actually made?  To
me, it doesn't seem like the relationship is made until of the objects
is saved into the database.  Let's say i have models like:

Library has_many :books
Book belongs_to :Library

If I have code such as:

book = Book.new

library = Library.new
library.books  book

it seems like library.books is empty UNTIL book is first saved.

this causes strange problems for me if I am trying to validate that a
book always belongs to a library, and a library has to have a least
one book.

Maybe I'm thinking about this the wrong way?

Thanks in advance,
Chris

--~--~-~--~~~---~--~~
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-talk@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 delete a record inside of an association

2009-03-20 Thread Nate

I'm a noob having a hard time, and it's probably really simple.

Here's the way it's set up:
Client has many Bins
Bin belongs to Client
In my Client show view I have it render a partial that lists all the
records in Bin associated with Client.

I need to have a destroy link for each of the Bin records. Right now I
have it configured in my Bin partial as:
%= link_to(Delete, { :action = destroy, :id = @bin }, :confirm
= Are you sure?, :method = :delete) %

This just throws back an error saying that there is not a Client with
that id.

I can't figure out how to tell it to delete the bin not the client
with that id.

Any helpful suggestions? Cheers.


--~--~-~--~~~---~--~~
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-talk@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: Generic link_to in a shared partial

2009-03-20 Thread acts_as_jason

Try...

%= link_to 'Edit', edit_path(rec) %

I am not positive about edit_path, but you can run rake routes to
get the specific path.

-J



On Mar 20, 2:36 pm, Bharat Ruparel rails-mailing-l...@andreas-s.net
wrote:
 I am trying to write a simple and generic one table maintenance shared
 partial which can be reused to maintain multiple tables with the
 following fields:

 id, name, created_by, updated_by.

 I am stuck in generating rest route correctly.  Here is an example for a
 crust_types table inspired by Ryan Bates Forms screencasts.

 Here is the index action from CrustTypeController:

   def index
     @crust_types = CrustType.find(:all)
     respond_to do |format|
       format.html # index.html.erb
       format.xml  { render :xml = @crust_types }
     end
   end

 Here is the content of corresponding index.html.erb template:

 %= render :partial = 'shared/crud_table', :object = @crust_types,
 :locals = {:ll = 'crust_type'} %

 Finally, here are the relevant code snippets from _crud_table.html.erb
 partial in the shared folder:

   % for a_rec in crud_table %
     tr class=%= cycle(odd,even) %
       td class=first%= a_rec.id %/td
       td%= a_rec.name %/td
       td%= a_rec.created_at %/td
       td%= a_rec.updated_at %/td
       td%= link_to 'Show', #{ll}_path % | %= link_to 'Edit',
 edit_#{ll}_path(#{ll}) % | %= link_to 'Destroy', #{ll}_path ,
 :confirm = 'Are you sure?', :method = :delete %/td
     /tr
   % end %

 The rest paths for link_to methods are not being evaluated they are
 literally output.  For example: I want the link_to 'Edit',
 edit_#{ll}_path(#{ll}) method to generate the correct edit path as
 '/crust_types/1/edit for the first record, instead, I get
 '/edit_crust_type_path(crust_type)'.  Clearly, it is not being
 evaluated.  How should I do it?

 Thanks in advance for your time.

 Bharat
 --
 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-talk@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] In Place Edit w/ TinyMCE ?????

2009-03-20 Thread acts_as_jason

Anyone able to get in place editing with tinyMCE working.

I have tried to implement this: http://inplacericheditor.box.re/

Everything seems to be working, except when the tinyMCE editor loads,
it ignores the current markup.

For example:

I have 2 paragraphs in p tags and 1 unordered list.

When I click the highlighted area, the tinyMCE editor loads, but all
the text is on one line. If I click the html button if the advanced
editor, it shows that all the content is wrapped in 1 p tag.

Any ideas

--~--~-~--~~~---~--~~
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-talk@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 requires RubyGems = 1.3.1 (you have 1.1.1) on OSX

2009-03-20 Thread Frederick Cheung


On 20 Mar 2009, at 19:48, Andre In la wrote:


 Any ideas for a solution? Is it possible I have more than one
 installation of ruby on my machine, with mongrel accessing the other
 one? How do I find out and how do I resolve this?

That is possible. Look at the output of
which mongrel_rails
which gem
which ruby

Fred

 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-talk@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: why does this happen...

2009-03-20 Thread ruby...@ymail.com



On 18 Mar., 19:23, Matt Jones al2o...@gmail.com wrote:
 RAFB apparently drops files after 24 hours - any chance you could put
 those examples up someplace (gist or pastie, for instance) with a
 little more persistence?

 Without seeing the code, it's hard to even guess what's going on. But
 I seem to recall seeing similar behavior when I had code saving an
 associated record in before_save, which then got picked up again by
 the association save callbacks.

I totally agree. Ball, you should really paste some code somewhere, so
we can try to figure out what's wrong here.

--
Cheers,
David Knorr
http://twitter.com/rubyguy
--~--~-~--~~~---~--~~
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-talk@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: Generic link_to in a shared partial

2009-03-20 Thread Bharat Ruparel

Hello Jason,
Thanks for your response.  Unfortunately that won't work since the local 
variable ll being passed to the partial determines which model are we 
working with so in my example that will have to be 
edit_crust_type_path(a_rec).  It is the dynamic substitution of the 
model name that I am getting stuck on.  Unfortunately I do not know the 
meta_programming magic required to make it work :)
Anyway I have managed to do it the old-fashioned way by explicitly 
spelling out the controllers and actions are shown below:

  % for a_rec in crud_table %
tr class=%= cycle(odd,even) %
  td class=first%= a_rec.id %/td
  td%= a_rec.name %/td
  td%= a_rec.created_at %/td
  td%= a_rec.updated_at %/td
  td%= link_to 'Show', :controller = ll, :action = 'show', :id 
= a_rec.id % |
  %= link_to 'Edit', :controller = ll, :action = 'edit', :id 
= a_rec.id % |
  %= link_to 'Destroy', {:controller = ll, :action = 
'destroy', :id = a_rec.id} , :confirm = 'Are you sure?' %/td
/tr
  % end %

This works fine, but I would still like to know how to do it using 
meta-programming.

Bharat
-- 
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-talk@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 2.3 and helpers within plugins

2009-03-20 Thread acras

Got it,

  Just put in my init.rb some lines like:

ActionView::Base.send :include, ResourcesHelper
ActionView::Base.send :include, AcApplicationHelper
ActionView::Base.send :include, LookupHelper

thanks

On 20 mar, 17:28, acras ricardo.ac...@gmail.com wrote:
 I'm starting to get it. Engines Plugin did some kind of generic
 include, making the helpers within a plugin to be available within the
 app.
 My question now is: how can I do it the best way?

 On 20 mar, 17:18, acras ricardo.ac...@gmail.com wrote:



  Hi,

    I'm porting a plugin of mine to work with rails 2.3. My plugin is
  based in engines.
    I'm doing good so far, the only problem is with helpers. Rails seems
  not to recognize helpers from my plugin.

  Anyone ran into this issue?
--~--~-~--~~~---~--~~
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-talk@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: HABTM and radio_button

2009-03-20 Thread ruby...@ymail.com



On 19 Mar., 16:41, elliottg x...@simplecircle.net wrote:
 Thanks for the input David.

 I'll explain myself a bit more here, maybe you could help me further?

 I am building an interface so an admin can create new users and assign
 them to have either a user or admin role using
 restful_authentication
 and role_requiremnt.

 I have a roles table that I have manually placed two records under the
 Name
 column for both user and admin. These are the only two user roles
 expected.
 It seems that if each time I add a new user and I add a new record
 under the Name column
 of the roles table as well that I am going to have a lot of redundant
 data in roles. IE there could be twenty entries under Name roles that
 say user and
 then X amount more that say admin. It would seem that I only need
 one record
 for each in roles to adhere to some semblance of DB normalcy
 ideals.?.?.

 Should only the user table and the join table be updated to somehow
 map to the correct existing roles Name record? IE user or admin.
 And if so, whats the code to do that?

If you would like to associate multiple users with the same two roles
in your database, you would have to do it like this:

@user.roles  Role.find_by_name(params[:role_name])

Keep in mind, that this is going to allow the user to have multiple
roles. The # method is going to add another role to the collection
of roles, the user already has. The params[:role_name] is simply the
name of the role, you'ld like the user to have, for example admin.

--
Cheers,
David Knorr
http://twitter.com/rubyguy
--~--~-~--~~~---~--~~
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-talk@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] Complex Query?

2009-03-20 Thread partydrone

I need to perform a Rails find with the following data model in my
controller:


download_types  --  downloads  --  downloads_products  --  products


I want to grab all downloads for a given product_id and list them by
download type. Download types is a sortable list (using a position
column in the table, and I want to make sure the download types are
sorted by that column). I'm thinking of something like this:

DownloadType.all(:include = :downloads, :conditions = ['product.id
= ?', params[:id]], :order = 'position, download.title')

I'm trying to figure out what to put in the middle, some sort
of :joins clause, but I'm not sure how it should look. In my view, it
seems the most logical to me to start looping through download types,
then loop through downloads for the given download type.

Any suggestions?

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-talk@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: Complex Query?

2009-03-20 Thread Sharagoz --

I think I'd do something like:
Download.find(:all, :include = [:products, :download_type], :conditions 
= [products.id=?,params[:id]], :order = 'download_type.position, 
title')
-- 
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-talk@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   >