[Rails] Buttons's routing

2011-06-13 Thread amritpal pathak
Hey
  My app has some buttons and i  have route all  to different action
in router.rb file but click on each  button results in same action. why?
 Am i missing to specify anything...)

 Rails:3.0.7

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] scaffold_controller generator

2011-06-13 Thread madth3
Hi:

I'm new to RoR and I apologize if this is a dumb question but I've
read the guides, searched the archives and found nothing.

If I generate a model object and then the scaffold_controller the
result is different than just running the scaffold generator (the
_form partial has no fields in the first case).
I did not expected this and I wanted to first create the models, tweak
them and then generate the scaffolds.

Did I made a mistake somewhere or is this by design?

Ruby 1.9.2
Rails 3.0.7

-- 
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.



Re: [Rails] Listing users with Devise

2011-06-13 Thread Jatin kumar
Refer to this:
http://www.tonyamoyal.com/2010/09/29/rails-authentication-with-devise-and-cancan-part-2-restful-resources-for-administrators/
and you are good to go. :)

On Tue, Jun 14, 2011 at 5:43 AM, Fernando Aureliano <
m...@fernandoaureliano.com> wrote:

> Someone already need to list the registrations of user from devise?
>
> I want to do this list, with the option of admin delete users.
>
> I did not found nothing about that on documentation =/
>
> --
> *Fernando Aureliano*
>
>
>  --
> 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.
>

-- 
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 convert Image To Text in RoR

2011-06-13 Thread rajeevkannav
Hello All


I have too many scanned notes i need to convert them into text and then user 
may download that as pdf  , How it can be done in RoR

Please help

Thanks in advance :) 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/IGsfkVoWt-4J.
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.



Re: [Rails] [Devise] Display a custom sign_UP form anywhere in your app

2011-06-13 Thread Fernando Aureliano
The form appears, I put the data and go!

Dont show any erros, but the data are not recorded

On Mon, Jun 13, 2011 at 10:27 PM, Tim Shaffer  wrote:

> Which part doesn't work?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/m5PzyPsORQ4J.
>
> 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.
>



-- 
*Fernando Aureliano*
--
[iOSDeveloper] - *ObjectiveC*
[WebDesigner] - *CSS3&HTML5*
*[WebDeveloper] - RubyOnRails*
*--
*
[portfolio]  -
[blog]
 - [personal blog]  -
[twitter]

-- 
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] error of looping in rails

2011-06-13 Thread Yennie
Hi,
I am writing this code in purpose that i can i select image from the
picture table and i want to get all the user so i can loop through
user1 , user2 

and display the pic on bowers..

 def show_image

@id  = User.find(:all, :select => 'user.id')

for id in @id

@image = ActiveRecord::Base.connection.select_value('select
image from Picture pic
inner join Cultures c on pic.culture_id = c.id
inner join user pt on pt.id =  p.user
where pt.id = "id"');

end

   send_data @image, :type => 'image/png', :disposition => 'inline'
end

and i get an error "(SQLite3::SQLException: ambiguous column name: id:
"

Please help and give me some advices.. Big thanks for 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.



Re: [Rails] [Devise] Display a custom sign_UP form anywhere in your app

2011-06-13 Thread Tim Shaffer
Which part doesn't work?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/m5PzyPsORQ4J.
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.



Re: [Rails] how to get the list of users' id

2011-06-13 Thread joanne ta
Sorry, I mean get the list of user id ...
cuz my query depends on user.id .. so i want to have a list which is array
to go through
the album..




On Mon, Jun 13, 2011 at 1:53 PM, Michael Pavling  wrote:

> On 13 June 2011 18:33, Yennie  wrote:
> >  @id  = User.find(:all,  :select => 'users.id')
> >@id.each do |i|
> >   @pic =  ActiveRecord::Base.connection.select_value(
> >select picture
> > from albums a
> >inner join Users u
> > on u.id = a.id
> >where u.id  = i )
> >   end
> > end
> >
> > please give me some advices...
>
> Assuming your users have a "has_many :pictures" relationship:
>
>  @pictures = User.all.map(&:pictures).flatten
>
> Or if your Users have many Albums, and Albums have many Pictures:
>
>  @pictures = User.all.map(&:albums).flatten.map(&:pictures).flatten
>
> (can probably use .inject to make that smaller, but you can look that
> up in the api docs)
>
> then you can iterate @pictures however you want in your views.
>
> but hang on...
>
> Aren't you just getting a list of all the Pictures? Why not use
> "Picture.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.
>
>

-- 
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] Listing users with Devise

2011-06-13 Thread Fernando Aureliano
Someone already need to list the registrations of user from devise?

I want to do this list, with the option of admin delete users.

   I did not found nothing about that on documentation =/

-- 
*Fernando Aureliano*

-- 
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.



Re: [Rails] [Devise] Display a custom sign_UP form anywhere in your app

2011-06-13 Thread Fernando Aureliano
Dont work.

maybe because I'm already logged in when I try a new register?

On Mon, Jun 13, 2011 at 2:35 PM, Tim Shaffer  wrote:

> Same way you'd display the form any other place I'd imagine...
>
> <%= form_for(User.new, :as => :user, :url => registration_path(:user)) do |f| 
> %>
>   <%= devise_error_messages! %>
>   form fields here...
>   <%= f.submit "Sign up" %>
> <% end %>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/M9XgyCg_Z8AJ.
> 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.
>



-- 
*Fernando Aureliano*
--
[iOSDeveloper] - *ObjectiveC*
[WebDesigner] - *CSS3&HTML5*
*[WebDeveloper] - RubyOnRails*
*--
*
[portfolio]  -
[blog]
 - [personal blog]  -
[twitter]

-- 
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: Problem with session on ajax request

2011-06-13 Thread Dimas Cyriaco
Excuse me, i have a typo in the text. What i was trying to say is that 
anything I include in the session (within the POST request) is NOT propagate 
to the next requests.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/6q-pS7qJq4IJ.
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] Problem with session on ajax request

2011-06-13 Thread Dimas Cyriaco
Guys, i'm having a problem similar with those reported with rails 3.0.4 and 
sessions with ajax requests.

The problem is that i have an action that receives an ajax POST and sets an 
session.

  def test
session[:user] = me
  end

but the session vanishes and don't become available in the next request.
The routes are OK, and anything else are working fine.

I don't believe that this relates to the csrf-token problem of rails 3.0.4 
because the token is passed to rails by jquery. And indeed i can access the 
session hash from within the POST request . But anything I include in the 
session (within the POST request) is propagate to the next request.

If anyone can help me i would be very thankful.
Dimas Cyriaco

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/Rrc10BVjxKsJ.
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.



Re: [Rails] errors.add_to_base

2011-06-13 Thread Peter Bell
Awesome - perfect. Thanks!

Best Wishes,
Peter

On Jun 13, 2011, at 6:11 PM, Martin Wawrusch wrote:

> errors.add(:base,"your text") 
> perhaps?
> 
> On Mon, Jun 13, 2011 at 3:08 PM, Peter Bell  wrote:
> Hmm, So it looks like erros.add_to_base is deprecated in ActiveModel:
> http://api.rubyonrails.org/classes/ActiveModel/Errors.html
> 
> I need to add an error, but I don't want to add it to a specific property (I 
> need you to fill out either a source_person or source_url, so I don't want to 
> prepend the message with the name of either of the fields).
> 
> Any idea how I might be able to do that now that we don't have add_to_base?
> 
> Best Wishes,
> Peter
> 
> -- 
> 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.
> 
> 
> 
> 
> 
> -- 
> 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.

-- 
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.



Re: [Rails] errors.add_to_base

2011-06-13 Thread Martin Wawrusch
errors.add(:base,"your text")
perhaps?

On Mon, Jun 13, 2011 at 3:08 PM, Peter Bell  wrote:

> Hmm, So it looks like erros.add_to_base is deprecated in ActiveModel:
> http://api.rubyonrails.org/classes/ActiveModel/Errors.html
>
> I need to add an error, but I don't want to add it to a specific property
> (I need you to fill out either a source_person or source_url, so I don't
> want to prepend the message with the name of either of the fields).
>
> Any idea how I might be able to do that now that we don't have add_to_base?
>
> Best Wishes,
> Peter
>
> --
> 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.
>

-- 
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] errors.add_to_base

2011-06-13 Thread Peter Bell
Hmm, So it looks like erros.add_to_base is deprecated in ActiveModel:
http://api.rubyonrails.org/classes/ActiveModel/Errors.html

I need to add an error, but I don't want to add it to a specific property (I 
need you to fill out either a source_person or source_url, so I don't want to 
prepend the message with the name of either of the fields).

Any idea how I might be able to do that now that we don't have add_to_base?

Best Wishes,
Peter

-- 
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] REQ:WEB DEVELOPER @VA

2011-06-13 Thread joe recruiter33
I have a Web Developer position available with the * Arlington, VA*. Please
let me know if you have anyone in mind.

Below is the JD.**
**
*Web Developer Technical Experience:** **
**- Experience developing and designing large, customer-facing websites** **
**- Expert skills in HTML, table-less CSS, JavaScript** **
**- Expert skills in Web Frameworks, preferably jQuery, AJAX, and JSON** **
**- Strong experience with cross-browser compatibility issues** **
**- Proven ability to develop to web standards including 508 compliance** **
**- Experience using debugging tools such as Firebug, IE developer tools,
and Chrome developer tools** **
**- Practical knowledge of XML and XSLT** **
**- Experience in a Linux environment** **
**- Experience with server-side coding, preferably using a scripting
language such as PHP, Python, Perl , or Tcl** **
**- Experience with SQL using an Oracle database** **
**- Experience using a version control system such as CVS, Subversion or git
*

*REGARDS*
*JOE*

-- 
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] Devise Authorization Error

2011-06-13 Thread jjb123
Hello everyone,
I am new to rails and I am having some trouble getting the Devise
authorization plugin working. I can get the login page to display, but
when I enter the credentials for a known user (I seeded an account to
the database) it just says "Invalid email or password," even though
I'm 100% sure I entered the right information, and redirects me to the
login form. I'm thinking this might be a namespace problem or
something but I'm not sure.

Here is the relevant code:

--- routes.rb ---
# Root
root :to => "content#index"

# Admin Controllers
namespace 'admin' do
  root :to => "admin#index"

  # AdminController
  devise_for :admin, :path=> '', :path_names => {:sign_in =>
'login', :sign_out => 'logout'}
  resources :admin
end

# UsersController
devise_for :users, :path_names => {:sign_in => 'login', :sign_out =>
'logout'}

--- END routes.rb ---

--- admin.rb (Model) ---
class Admin < ActiveRecord::Base
 
devise :database_authenticatable, :recoverable, :rememberable, :trackable, 
:validatable
 
attr_accessible :email, :password, :password_confirmation, :first_name, 
:last_name, :superadmin
end

--- END admin.rb ---

--- new.html.erb (The login form) ---

Administrator Login

<%= flash[:notice] %>
<%= flash[:alert] %>

<%= form_for(resource, :as => resource_name, :url =>
session_path(resource_name), :html => {:id => :admin_login_form}) do |
f| %>



<%= f.label :email %>


<%= f.email_field :email %>




<%= f.label :password %>


<%= f.password_field :password %>


<% if devise_mapping.rememberable? -%>


<%= f.label :remember_me %>


<%= f.check_box :remember_me %>


<% end -%>


<%= f.submit "Sign in" %>
<% end %>

<%= render :partial => "devise/shared/links" %>



--- END new.html.erb ---

 Any help with this 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: RSpec / Capybara ? (from The RSpec Book): Why might "should have_selector" silently pass when nested?

2011-06-13 Thread David Chelimsky
On Jun 13, 1:22 pm, daze  wrote:
> Thank you.  But then what should be the work around for this with
> Capybara?  I was leaning toward using capybara...


rendered.should have_selector("form input[@type='submit']")

You can also use assert_select which ships with Rails and supports
nesting if you prefer.

> Actually, do you recommend webrat over capybara?  I just want one with
> good documentation and stick with one for the sake of getting used to
> the syntax.

That's tricky. Capybara is under regular development and has a growing
user base. Webrat has been around longer and already supports the
matchers you're looking for, but hasn't had a commit in 5 months. I'm
using Capy on new projects if you want to take that as a
recommendation.

> Now... One last thing.  I notice that when I try webrat, has_content?
> no longer works.
> I'm guessing has_content? is specific to Capybara... is "should
> contain" the equivalent in webrat?

Yep.

>
> Thanks again.
>
> On Jun 13, 11:02 am, David Chelimsky  wrote:
>
>
>
> > On Jun 13, 8:36 am, daze  wrote:
>
> > > I'm going through The RSpec Book, and (specifically around page 333) I
> > > encountered a problem.  Basically, whenever I use "should
> > > have_selector" in a nested form, it silently passes when it SHOULD
> > > fail.
>
> > > I've been copying the code exactly as from the book.  Now, there is
> > > one major difference - I'm using Capybara while the book is using
> > > Webrat.  Why?  I've had bigger problems with Webrat.  In fact, when I
> > > switch to Webrat by putting it in the Gemfile, I get this unidentified
> > > method error in which has_selector isn't recognized (which is doubly
> > > odd because this happens where I call have_selector...)
>
> > > Anyway, here's the code:
>
> > > ---new.html.erb_spec.rb---
>
> > > require 'spec_helper'
>
> > > describe "messages/new.html.erb" do
>
> > >   let(:message) do
> > >     mock_model("Message").as_new_record.as_null_object
> > >   end
>
> > >   before do
> > >     assign :message, message
> > >   end
>
> > >   it "renders a form to create a message" do
> > >     render
> > >     rendered.should have_selector("form",
> > >       :method => "post",
> > >       :action => messages_path
> > >     ) do |form|
> > >       form.should have_selector("input", :type => "submit")  # this
> > > should be failing right now!!!
> > >     end
> > >   end
>
> > >   # this should be failing right now!!!
> > >   it "renders a text field for the message title" do
> > >     message.stub(:title => "the title")
> > >     render
> > >     rendered.should have_selector("form") do |form|
> > >       form.should have_selector("input",
> > >         :type => "submit",
> > >         :name => "message[title]",
> > >         :value => "the title"
> > >       )
> > >     end
> > >   end
>
> > >   # this should be failing right now!!!
> > >   it "renders a text area for the message text" do
> > >     message.stub(:text => "the message")
> > >     render
> > >     rendered.should have_selector("form") do |form|
> > >       form.should have_selector("textarea",
> > >         :name => "message[text]",
> > >         :content => "the message"
> > >       )
> > >     end
> > >   end
> > > end
>
> > > -new.html.erb--
>
> > > <%= form_for @message do |f| %>
>
> > > # nothing is in here, so those nested "should have_selector"
> > > statements should fail
>
> > > <% end %>
>
> > > Thanks in advance!
>
> > The examples in the book use webrat, which has a has_selector matcher
> > that supports nesting. The capybara have_selector matcher does not
> > support nesting (yet). You don't get any feedback because Ruby lets
> > you pass a block to any method, and leaves it to the method to handle
> > it or ignore it. In this case it's being ignored.
>
> > HTH,
> > David

-- 
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] Nested Attributes Link / Save to An Existing Record

2011-06-13 Thread Linda
Happy Monday Everyone,
Would you kindly help out a struggling nuby in solving this problem? I
have been researching all over, yet to find a workable solution.

Situation:  A model [Announcement] that accepts nested attributes
[Recipients] via many_to_many :through => :awards relationship.

The Desired Outcome:
#1. If a recipient's email in the announcement form is not found in
the existing recipients' data, then a new recipient is created.
#2. If a recipient's email is already in the database, then simply add
award to their existing award profile without creating a new
recipient.id

My Struggle:  The desired outcome #1 is satisfied w/ the current
code.  However when a recipient's email is already in the database,
this error shown up "Recipient email already existed" - preventing
saving into their award record.  What should I do so that the desired
outcome #2 can be met?

See detailed code here:  http://pastie.org/2062009

Many thanks in advance,
Linda

-- 
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: RSpec / Capybara ? (from The RSpec Book): Why might "should have_selector" silently pass when nested?

2011-06-13 Thread daze
Thank you.  But then what should be the work around for this with
Capybara?  I was leaning toward using capybara...

Actually, do you recommend webrat over capybara?  I just want one with
good documentation and stick with one for the sake of getting used to
the syntax.

Now... One last thing.  I notice that when I try webrat, has_content?
no longer works.
I'm guessing has_content? is specific to Capybara... is "should
contain" the equivalent in webrat?

Thanks again.

On Jun 13, 11:02 am, David Chelimsky  wrote:
> On Jun 13, 8:36 am, daze  wrote:
>
>
>
>
>
>
>
>
>
> > I'm going through The RSpec Book, and (specifically around page 333) I
> > encountered a problem.  Basically, whenever I use "should
> > have_selector" in a nested form, it silently passes when it SHOULD
> > fail.
>
> > I've been copying the code exactly as from the book.  Now, there is
> > one major difference - I'm using Capybara while the book is using
> > Webrat.  Why?  I've had bigger problems with Webrat.  In fact, when I
> > switch to Webrat by putting it in the Gemfile, I get this unidentified
> > method error in which has_selector isn't recognized (which is doubly
> > odd because this happens where I call have_selector...)
>
> > Anyway, here's the code:
>
> > ---new.html.erb_spec.rb---
>
> > require 'spec_helper'
>
> > describe "messages/new.html.erb" do
>
> >   let(:message) do
> >     mock_model("Message").as_new_record.as_null_object
> >   end
>
> >   before do
> >     assign :message, message
> >   end
>
> >   it "renders a form to create a message" do
> >     render
> >     rendered.should have_selector("form",
> >       :method => "post",
> >       :action => messages_path
> >     ) do |form|
> >       form.should have_selector("input", :type => "submit")  # this
> > should be failing right now!!!
> >     end
> >   end
>
> >   # this should be failing right now!!!
> >   it "renders a text field for the message title" do
> >     message.stub(:title => "the title")
> >     render
> >     rendered.should have_selector("form") do |form|
> >       form.should have_selector("input",
> >         :type => "submit",
> >         :name => "message[title]",
> >         :value => "the title"
> >       )
> >     end
> >   end
>
> >   # this should be failing right now!!!
> >   it "renders a text area for the message text" do
> >     message.stub(:text => "the message")
> >     render
> >     rendered.should have_selector("form") do |form|
> >       form.should have_selector("textarea",
> >         :name => "message[text]",
> >         :content => "the message"
> >       )
> >     end
> >   end
> > end
>
> > -new.html.erb--
>
> > <%= form_for @message do |f| %>
>
> > # nothing is in here, so those nested "should have_selector"
> > statements should fail
>
> > <% end %>
>
> > Thanks in advance!
>
> The examples in the book use webrat, which has a has_selector matcher
> that supports nesting. The capybara have_selector matcher does not
> support nesting (yet). You don't get any feedback because Ruby lets
> you pass a block to any method, and leaves it to the method to handle
> it or ignore it. In this case it's being ignored.
>
> HTH,
> David

-- 
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.



Re: [Rails] how to get the list of users' id

2011-06-13 Thread Michael Pavling
On 13 June 2011 18:33, Yennie  wrote:
>  @id  = User.find(:all,  :select => 'users.id')
>        @id.each do |i|
>           @pic =  ActiveRecord::Base.connection.select_value(
>                                                    select picture
> from albums a
>                                                    inner join Users u
> on u.id = a.id
>                                                    where u.id  = i )
>       end
> end
>
> please give me some advices...

Assuming your users have a "has_many :pictures" relationship:

  @pictures = User.all.map(&:pictures).flatten

Or if your Users have many Albums, and Albums have many Pictures:

  @pictures = User.all.map(&:albums).flatten.map(&:pictures).flatten

(can probably use .inject to make that smaller, but you can look that
up in the api docs)

then you can iterate @pictures however you want in your views.

but hang on...

Aren't you just getting a list of all the Pictures? Why not use "Picture.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.



Re: [Rails] [Devise] Display a custom sign_UP form anywhere in your app

2011-06-13 Thread Tim Shaffer
Same way you'd display the form any other place I'd imagine...

<%= form_for(User.new, :as => :user, :url => registration_path(:user)) do |f| %>
  <%= devise_error_messages! %>
  form fields here...
  <%= f.submit "Sign up" %>
<% end %>


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/M9XgyCg_Z8AJ.
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 get the list of users' id

2011-06-13 Thread Yennie
Hi,

I have a question that how to take a list of user on user table

def show_pic

 @id  = User.find(:all,  :select => 'users.id')
@id.each do |i|
   @pic =  ActiveRecord::Base.connection.select_value(
select picture
from albums a
inner join Users u
on u.id = a.id
where u.id  = i )
   end
end

please give me some advices...


THanls you so much

-- 
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: RSpec / Capybara ? (from The RSpec Book): Why might "should have_selector" silently pass when nested?

2011-06-13 Thread David Chelimsky
On Jun 13, 8:36 am, daze  wrote:
> I'm going through The RSpec Book, and (specifically around page 333) I
> encountered a problem.  Basically, whenever I use "should
> have_selector" in a nested form, it silently passes when it SHOULD
> fail.
>
> I've been copying the code exactly as from the book.  Now, there is
> one major difference - I'm using Capybara while the book is using
> Webrat.  Why?  I've had bigger problems with Webrat.  In fact, when I
> switch to Webrat by putting it in the Gemfile, I get this unidentified
> method error in which has_selector isn't recognized (which is doubly
> odd because this happens where I call have_selector...)
>
> Anyway, here's the code:
>
> ---new.html.erb_spec.rb---
>
> require 'spec_helper'
>
> describe "messages/new.html.erb" do
>
>   let(:message) do
>     mock_model("Message").as_new_record.as_null_object
>   end
>
>   before do
>     assign :message, message
>   end
>
>   it "renders a form to create a message" do
>     render
>     rendered.should have_selector("form",
>       :method => "post",
>       :action => messages_path
>     ) do |form|
>       form.should have_selector("input", :type => "submit")  # this
> should be failing right now!!!
>     end
>   end
>
>   # this should be failing right now!!!
>   it "renders a text field for the message title" do
>     message.stub(:title => "the title")
>     render
>     rendered.should have_selector("form") do |form|
>       form.should have_selector("input",
>         :type => "submit",
>         :name => "message[title]",
>         :value => "the title"
>       )
>     end
>   end
>
>   # this should be failing right now!!!
>   it "renders a text area for the message text" do
>     message.stub(:text => "the message")
>     render
>     rendered.should have_selector("form") do |form|
>       form.should have_selector("textarea",
>         :name => "message[text]",
>         :content => "the message"
>       )
>     end
>   end
> end
>
> -new.html.erb--
>
> <%= form_for @message do |f| %>
>
> # nothing is in here, so those nested "should have_selector"
> statements should fail
>
> <% end %>
>
> Thanks in advance!

The examples in the book use webrat, which has a has_selector matcher
that supports nesting. The capybara have_selector matcher does not
support nesting (yet). You don't get any feedback because Ruby lets
you pass a block to any method, and leaves it to the method to handle
it or ignore it. In this case it's being ignored.

HTH,
David

-- 
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] QA Analyst - IN

2011-06-13 Thread Eric Hoffman
Dear Associate,

This is Eric Hoffman from Panzer Solutions LLC, Let me know if you suitable
consultant for below position. If so, send me your updated resume and
contact details.

*Position: QA Analyst
Location : Indianapolis, IN
Duration: 12 months*

*Rate: $35/hr*

Candidates HAVE to have several years of Rational Functional Tester exp as
well as Rational Quality Manager and ClearQuest.

Location : Indianapolis, IN
Length-12 Months

Responsible for assisting in the design/development of product
testing/quality processes and assists in developing testing architecture
equal to that of commercial quality software.
Assists in coordinating automation of test cases. Monitors current reference
architecture and monitors/collects testing/product quality data. Monitors
functional features, performance and service requirements/components.
Conducts testing to assure developed product conforms to requirements and
design. Assists in reviewing an application for testing needs and
requirements/design quality. Consults to projects and application support
groups regarding quality and testing and may participate in the transition
of software and systems into production. Prepares and executes test assets
and executes linkage from test plan to test scenarios and cases. Performs
other duties as assigned.

BA/BS in Computer Science or Information Systems or equivalent combination
of education and experience required. 1-3 years of testing/product quality
experience is preferred. SKILLS: Requires a basic understanding of
testing/product quality processes, tools and methods and an understanding or
organizational impacts and trade-offs of quality processes
- 5+ years of uautomated testing mission critical projects - Project Based
Testing!
 - Expertise with Rational Functional Tester (RFT)
 - Expertise with ClearQuest
 - Expertise with Rational Quality Manager(RQM)
 - Self directed and proactive
 - WP and/or Healthcare experience strongly prefered
 - QA Certification Preferred

Best Regards,
Eric Hoffman | Technical Recruiter
Voice: 203-971-8471
Email Id: e...@panzersoluitons.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.



Re: [Rails] Re: Problem with undefined variable current_user

2011-06-13 Thread Jen

Hi,
Moved the authenticate method to the helper, after looking at the sample 
app code from github. This seems to have solved the problem.


Thanks,
Jen.
On 13/06/11 14:49, Simon Baumgartner wrote:

Are you including SessionsHelper in you ApplicationController ?

class ApplicationController<  ActionController::Base
   protect_from_forgery
   include SessionsHelper
end

Simon

On Jun 12, 3:43 pm, Jen  wrote:

Hi everyone,
I'm working through the tutorial at the following link and attempting to
customise/adapt the lessons for my own slightly different application.

Link:
Ruby on Rails Tutorial: Learn Rails by Example | Ruby on Rails 3
Tutorial book and screencasts | by Michael Hartl


I'm currently trying to work through chapter 10, but having some
problems with the variable 'current_user' not being properly defined in
the 'signed_in' method. Everything looks fine to me, but  as I am
obviously missing something I'd appreciate it if someone with more
experience at debugging could point me in the right direction.

I can sign in with my test users and the exception only occures when
attempting to edit a profile.

Controller and model are attached.
Cheers,
Jen.

Error:

   NameError in UsersController#edit

undefined local variable or method `current_user' for 
#

|Rails.root: /home/resource_portal/website|

Application Trace  | Framework
Trace  | Full Trace


|app/helpers/sessions_helper.rb:17:in `signed_in?'
app/controllers/users_controller.rb:91:in `authenticate'
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks 
.rb:436:in `_run__1056153724__process_action__372525482__callbacks'
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks 
.rb:409:in `_run_process_action_callbacks'
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks 
.rb:93:in `run_callbacks'
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/abstract_controller/callbac 
ks.rb:17:in `process_action'
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/ins 
trumentation.rb:30:in `block in process_action'
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notificat 
ions.rb:52:in `block in instrument'
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notificat 
ions/instrumenter.rb:21:in `instrument'
rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notificat 
ions.rb:52:in `instrument'
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/ins 
trumentation.rb:29:in `process_action'
rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/res 
cue.rb:17:in `process_action'|
...

  users_controller.rb
2KViewDownload

  sessions_helper.rb
1KViewDownload




--
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: Problem with undefined variable current_user

2011-06-13 Thread Simon Baumgartner
Are you including SessionsHelper in you ApplicationController ?

class ApplicationController < ActionController::Base
  protect_from_forgery
  include SessionsHelper
end

Simon

On Jun 12, 3:43 pm, Jen  wrote:
> Hi everyone,
> I'm working through the tutorial at the following link and attempting to
> customise/adapt the lessons for my own slightly different application.
>
> Link:
> Ruby on Rails Tutorial: Learn Rails by Example | Ruby on Rails 3
> Tutorial book and screencasts | by Michael Hartl
> 
>
> I'm currently trying to work through chapter 10, but having some
> problems with the variable 'current_user' not being properly defined in
> the 'signed_in' method. Everything looks fine to me, but  as I am
> obviously missing something I'd appreciate it if someone with more
> experience at debugging could point me in the right direction.
>
> I can sign in with my test users and the exception only occures when
> attempting to edit a profile.
>
> Controller and model are attached.
> Cheers,
> Jen.
>
> Error:
>
>   NameError in UsersController#edit
>
> undefined local variable or method `current_user' for 
> #
>
> |Rails.root: /home/resource_portal/website|
>
> Application Trace  | Framework
> Trace  | Full Trace
> 
>
> |app/helpers/sessions_helper.rb:17:in `signed_in?'
> app/controllers/users_controller.rb:91:in `authenticate'
> rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks 
> .rb:436:in `_run__1056153724__process_action__372525482__callbacks'
> rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks 
> .rb:409:in `_run_process_action_callbacks'
> rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/callbacks 
> .rb:93:in `run_callbacks'
> rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/abstract_controller/callbac 
> ks.rb:17:in `process_action'
> rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/ins 
> trumentation.rb:30:in `block in process_action'
> rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notificat 
> ions.rb:52:in `block in instrument'
> rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notificat 
> ions/instrumenter.rb:21:in `instrument'
> rake-0.8.7/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/notificat 
> ions.rb:52:in `instrument'
> rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/ins 
> trumentation.rb:29:in `process_action'
> rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/res 
> cue.rb:17:in `process_action'|
> ...
>
>  users_controller.rb
> 2KViewDownload
>
>  sessions_helper.rb
> 1KViewDownload

-- 
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: Problem with undefined variable current_user

2011-06-13 Thread Tim Shaffer
The error message is pretty clear - You haven't defined a current_usermethod in 
your helper.

Check out Listing 9.16 in that tutorial you posted. That's where it 
describes the current_user method you need to add.

http://ruby.railstutorial.org/chapters/sign-in-sign-out#code:current_user_working

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/1sGjKBBYzikJ.
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] RSpec / Capybara ? (from The RSpec Book): Why might "should have_selector" silently pass when nested?

2011-06-13 Thread daze
I'm going through The RSpec Book, and (specifically around page 333) I
encountered a problem.  Basically, whenever I use "should
have_selector" in a nested form, it silently passes when it SHOULD
fail.

I've been copying the code exactly as from the book.  Now, there is
one major difference - I'm using Capybara while the book is using
Webrat.  Why?  I've had bigger problems with Webrat.  In fact, when I
switch to Webrat by putting it in the Gemfile, I get this unidentified
method error in which has_selector isn't recognized (which is doubly
odd because this happens where I call have_selector...)

Anyway, here's the code:

---new.html.erb_spec.rb---

require 'spec_helper'

describe "messages/new.html.erb" do

  let(:message) do
mock_model("Message").as_new_record.as_null_object
  end

  before do
assign :message, message
  end

  it "renders a form to create a message" do
render
rendered.should have_selector("form",
  :method => "post",
  :action => messages_path
) do |form|
  form.should have_selector("input", :type => "submit")  # this
should be failing right now!!!
end
  end

  # this should be failing right now!!!
  it "renders a text field for the message title" do
message.stub(:title => "the title")
render
rendered.should have_selector("form") do |form|
  form.should have_selector("input",
:type => "submit",
:name => "message[title]",
:value => "the title"
  )
end
  end

  # this should be failing right now!!!
  it "renders a text area for the message text" do
message.stub(:text => "the message")
render
rendered.should have_selector("form") do |form|
  form.should have_selector("textarea",
:name => "message[text]",
:content => "the message"
  )
end
  end
end

-new.html.erb--

<%= form_for @message do |f| %>

# nothing is in here, so those nested "should have_selector"
statements should fail

<% end %>


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.



Re: [Rails] Spreadsheet view in rails + share options

2011-06-13 Thread Max Schubert
Investigate javascript grids - there is a growing collection of both
free and pay-for clieent side grid frameworks available :)

Extjs
Jquery grid

Are two that come to mind.

Max

On 6/13/11, sar_dev  wrote:
> Hi
>
> I need to create a single page spreadsheet web application in RAILS
> which should be exactly like google doc(should not use google docs
> API). It should have the following features
>
> 1) should scroll from row to row/ cell to cell using arrow keys and
> also want to copy and paste from cell to cell .
>
> 2)Adding , editing and deleting a record and it should contain sharing
> access for particular users  .
>
> 3) If  one user modifies the spreadsheet it should immediately reflect
> to all user who has permission to view that document.
>
> 3) overall it should be in a spreadsheet view.
>
> If there is any other way to solve this solution means can u suggest
> me?? or please provide me a proper solution..
>
> 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.
>
>

-- 
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] force any controller to use HTTPS - ssl_requirement for Rails 2.x app

2011-06-13 Thread rtacconi
I have a Rails 2 app using ssl_requirement plugin. Is it possible to
force HTTPS in any controller with one statement, instead of defining
the actions in any controller? \
i.e. ssl_required :all => :force

-- 
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] Spreadsheet view in rails + share options

2011-06-13 Thread sar_dev
Hi

I need to create a single page spreadsheet web application in RAILS
which should be exactly like google doc(should not use google docs
API). It should have the following features

1) should scroll from row to row/ cell to cell using arrow keys and
also want to copy and paste from cell to cell .

2)Adding , editing and deleting a record and it should contain sharing
access for particular users  .

3) If  one user modifies the spreadsheet it should immediately reflect
to all user who has permission to view that document.

3) overall it should be in a spreadsheet view.

If there is any other way to solve this solution means can u suggest
me?? or please provide me a proper solution..

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.



Re: [Rails] check_box_tag, include value only if.....

2011-06-13 Thread Colin Law
On 13 June 2011 11:43, Mauro  wrote:
> On 13 June 2011 07:35, Colin Law  wrote:
>> On 12 June 2011 23:46, Mauro  wrote:
>>> I have:
>>> check_box_tag "supplier[category_ids][]",
>>> category.id,@supplier.categories.include?(category).
>>> I want to include @supplier.categories.include?(category) only if
>>> @supplier is not nil.
>>
>> Have you tried
>> (@supplier.categories.include?(category) if @supplier)
>
> mm it seems to work.
> Sorry, I had try the same code yesterday but it didn't work, it was
> late perhaps I was very tired, sorry again.

No problem, it can be fiddly sometimes to get such things to work.  If
one is not certain that it *should* work then a syntax error puts one
off the whole idea.  When I said "have you tried ..." I was not at all
suggesting that it was so obvious that only one mentally challenged
would have failed :)

Colin

Colin

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



Re: [Rails] check_box_tag, include value only if.....

2011-06-13 Thread Mauro
On 13 June 2011 07:35, Colin Law  wrote:
> On 12 June 2011 23:46, Mauro  wrote:
>> I have:
>> check_box_tag "supplier[category_ids][]",
>> category.id,@supplier.categories.include?(category).
>> I want to include @supplier.categories.include?(category) only if
>> @supplier is not nil.
>
> Have you tried
> (@supplier.categories.include?(category) if @supplier)

mm it seems to work.
Sorry, I had try the same code yesterday but it didn't work, it was
late perhaps I was very tired, sorry again.

-- 
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.



Re: [Rails] Re: Ruport csv exporting failing on trivial dump

2011-06-13 Thread Federico Rota
Thanks for your reply Andrew. Your answer saved me from googling a little
bit more.
I'll have a look to the quick fix.
If you need more details let me know.

Thanks

On Sun, Jun 12, 2011 at 11:14 PM, Andrew France
wrote:

> Hi Federico,
>
> Ruport is not currently Ruby 1.9.2 compatible, sorry. I started
> working on making it so two days ago and am still working on getting
> the test suite running.
>
> You'll find the Google Group for Ruport at
> http://groups.google.com/group/ruby-reports
> and the main repository at https://github.com/ruport/ruport. You'll
> find a quick fix for the CSV issue  at
> https://github.com/ruport/ruport/pull/7.
> PDF Writer seems to have more issues, there is some work in forks that
> I might be able to merge.
>
> As none of this is a Rails issue, it seems appropriate to switch to
> the Ruport group to continue this conversation and I have cc'ed it
> (hopefully).
>
> Regards,
> Andrew
>
>
> On Jun 11, 5:21 pm, Federico Rota  wrote:
> > Hi guys,
> > I need to export/import my habtm association to various formats so I
> > installed ruport.
> > These are my gems installed ('bundle install output'), as you can see i
> have
> > all the goodies i need (fastercsv, ruport, ruport-util,
> acts_as_reportable):
> > Using rake (0.8.7)
> > Using abstract (1.0.0)
> > Using activesupport (3.0.5)
> > Using builder (2.1.2)
> > Using i18n (0.5.0)
> > Using activemodel (3.0.5)
> > Using erubis (2.6.6)
> > Using rack (1.2.2)
> > Using rack-mount (0.6.14)
> > Using rack-test (0.5.7)
> > Using tzinfo (0.3.26)
> > Using actionpack (3.0.5)
> > Using mime-types (1.16)
> > Using polyglot (0.3.1)
> > Using treetop (1.4.9)
> > Using mail (2.2.15)
> > Using actionmailer (3.0.5)
> > Using arel (2.0.9)
> > Using activerecord (3.0.5)
> > Using activeresource (3.0.5)
> > Using fastercsv (1.5.4)
> > Using color (1.4.1)
> > Using hoe (2.9.4)
> > Using transaction-simple (1.4.0)
> > Using pdf-writer (1.1.8)
> > Using ruport (1.6.3)
> > Using acts_as_reportable (1.1.1)
> > Using bundler (1.0.15)
> > Using thor (0.14.6)
> > Using railties (3.0.5)
> > Using jquery-rails (1.0.7)
> > Using mailfactory (1.4.0)
> > Using rails (3.0.5)
> > Using rubyzip (0.9.4)
> > Using ruport-util (0.14.0)
> > Using sqlite3 (1.3.3)
> >
> > I've added the require "ruport"  line in my config/environment.rb file as
> > reported here:http://www.rubyreports.org/examples.html#aar.
> > I've added the acts_as_reportable line in my model.
> > Now, if I fire up my rails console and do "Foo.report_table" the output
> is
> > fine; if I do Foo.report_table.to_html the output is also fine.
> >
> > If I try Foo.report_table.to_csv i get the following error:
> >
> > irb(main):002:0> Foo.report_table.to_csv
> > NoMethodError: undefined method `instance' for
> Ruport::Formatter::CSV:Class
> > from C:/Ruby192/lib/ruby/1.9.1/csv.rb:2324:in `CSV'
> > from
> > C:/Ruby192/lib/ruby/gems/1.9.1/gems/ruport-1.6.3/lib/ruport/formatt
> > er/csv.rb:59:in `csv_writer'
> >
> > With Foo.report_table.to_pdf i get:
> > irb(main):010:0> Link.report_table.to_pdf
> > SyntaxError:
> > C:/Ruby192/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer
> > .rb:712: invalid multibyte char (US-ASCII)
> >
> C:/Ruby192/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712:
> > inva
> > lid multibyte char (US-ASCII)
> >
> C:/Ruby192/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712:
> > synt
> > ax error, unexpected $end, expecting keyword_end
> > content = "%PDF-#{@version}\n%âãÏÓ\n"
> >
> > So, my questions are:
> >  1) What's wrong with my .to_csv call? Maybe something about my
> application
> > configuration?
> >  2) Can you do that call simply with editing you environment.rb file like
> > reported above and with the acts_as_reportable directive in your model?
> >  3) Is Ruport the best solution for my export/import csv target objective
> or
> > maybe there's a better gem? (I might have much more complex reports in
> > future, so i would like a 'multi-format' gem)
> >
> > Working on Rails version 3.0.5.
> >
> > Thank you for your time,
> >
> > Federico
>
> --
> 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.
>
>

-- 
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.



Re: [Rails] Re: Different user sessions with different domain name?

2011-06-13 Thread ratnadeepdeshm...@gmail.com
On Thu, Jun 9, 2011 at 6:16 AM, tashfeen.ekram wrote:

> just to make sure i dunerstood this. so to optimize ranking, when
> soeone types in xxx.com it should be routed to www.xxx.com at the
> level of the http server?
>
>
yes, you are right.


> On Jun 2, 5:10 am, Chris Kottom  wrote:,
> > Yes, important point there.  The choice to host across multiple
> subdomains
> > should be made for a reason, not by default.  If the subdomain is an
> > essential part of the user's request (Google up "Basecamp style
> subdomains"
> > if you're not sure what I mean by this) then it's possible that you'd
> want
> > separate cookies for each subdomain.  In the vast majority of cases
> however,
> > the application isn't inferring anything from the subdomain, and you're
> > potentially losing PageRank.
> >
> > Making the configuration at the web server will help you with both
> problems,
> > if it is in fact a problem to have more than one subdomain, whereas the
> > Rails-only solution helps only with cookie management.
> >
> > On Thu, Jun 2, 2011 at 9:53 AM, ratnadeepdeshm...@gmail.com <
> >
> >
> >
> >
> >
> >
> >
> > ratnadeepdeshm...@gmail.com> wrote:
> > > But overall redirection from non www to www or vice versa should be
> done at
> > > least for "www" subdomain.. As google bot considers www and non www as
> two
> > > different sites.
> >
> > > So go with Apache configs way if you want www and non www to be same.
> >
> > > And go with Rails cookies way, if you really have some subdomains like
> > > app1.example.com and app2.example.com, where app1 and app2 are sharing
> the
> > > session.
> >
> > > On Thu, Jun 2, 2011 at 9:18 AM, jiblethead 
> wrote:
> >
> > >> > in config/initializers/session_store.rb
> >
> > >> > MyApp::Application.config.session_store :cookie_store, :key =>
> > >> > '_my_app_session', :domain => 'xxx.com'
> >
> > >> the solution I've found to work consistently is to modify as above,
> > >> but set :domain => '.xxx.com'
> >
> > >> Having the leading period (.) will set a common cookie that is shared
> > >> by all subdomains.  I use this technique to handle a secure subdomain
> > >> vs. a www subdomain, without creating new sessions between the two.
> >
> > >> Kevin
> >
> > >> --
> > >> 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.
> >
> > > --
> > > Ratnadeep Deshmane.
> > >http://rtdptech.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.
>
> --
> 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.
>
>


-- 
Ratnadeep Deshmane.
http://rtdptech.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: [Bangalore RUG] [ANN] RestfulRouteVersion 0.2 for making API versioning easier

2011-06-13 Thread hemant
Sure. Is there anything I need to do for that?



On Mon, Jun 13, 2011 at 11:42 AM, Satish N Kota
 wrote:
> Cool and congrats...would you like this to go on IndiaRubyConsortium?
>
> Thanks and Regards
> Satish Kota
> Administrator, IndiaRubyConsortium
>
>
> -Original Message-
> From: bangalore...@googlegroups.com [mailto:bangalore...@googlegroups.com]
> On Behalf Of hemanth
> Sent: Sunday, June 12, 2011 11:50 PM
> To: rubyonrails-talk@googlegroups.com; bangalore...@googlegroups.com
> Subject: [Bangalore RUG] [ANN] RestfulRouteVersion 0.2 for making API
> versioning easier
>
> Hi folks,
>
> Restful_route_version makes it easier for programmers to create
> different version of REStful or RESTlike APIs.
>
> It extends Rails routing api, making following possible:
>
> version_namespace :api do
>  version_namespace(:v10,:cache_route => true) do
>    resources :articles
>    resources :comments
>    resources :notes
>  end
>
>  version_namespace(:v11, :cache_route => true) do
>    inherit_routes("/api/v10", :except => %w(articles))
>    resources :articles
>    resources :tags
>  end
> end
>
> But it goes beyond that, for all the inherited routes, it
> automatically defines new version of controllers, which inherit the
> previous versions. However, if you wish you can override specific
> controllers and actions, and it stays out the your way. It also comes
> with a inherited view resolver - and hence lets you have inheritable
> templates on Rails 3.0.x series.
>
> This is a Rails 3 compatible release of gem and should work with Rails
> 3.1 as well.
>
> More details:
>
> https://github.com/gnufied/restful_route_version
>
> Any questions or feedback is most welcome.
>
>
>
> --
> Let them talk of their oriental summer climes of everlasting
> conservatories; give me the privilege of making my own summer with my
> own coals.
>
> http://gnufied.org
>
>



-- 
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org

-- 
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.



Re: [Rails] Need security patches

2011-06-13 Thread Colin Law
On 13 June 2011 08:05, seeni khan  wrote:
> Hi All,
> I am using rails2.3.4 version ruby version 1.8.7 for my product.My client
> suggest me to apply if any security patches (security needs to be fixed in
> rails 2.3.4 & ruby 1.8.7) available. I dont know where and how should i find
> it.Please suggest me an idea or anyone knows any security patches for the
> same.

You should upgrade to the latest 2.3.x version of Rails.  Or to
version 3 if you wish but that is more work.  Make sure you have full
automated test coverage first so that you can be sure the upgrade has
not broken anything.

Colin

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



Re: [Rails] check_box_tag, include value only if.....

2011-06-13 Thread Colin Law
On 12 June 2011 23:46, Mauro  wrote:
> I have:
> check_box_tag "supplier[category_ids][]",
> category.id,@supplier.categories.include?(category).
> I want to include @supplier.categories.include?(category) only if
> @supplier is not nil.

Have you tried
(@supplier.categories.include?(category) if @supplier)

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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 3.07 dup issue

2011-06-13 Thread Nash
If you want deep copy you should use Marshal:

class Hash
  def deep_dup
Marshal::load(Marshal::dump(self))
  end
end

foo = {:b=>{:c=>{:d=>1}}}
bar = foo.deep_dup

foo[:b][:c][:d] = 2
p foo # => {:b=>{:c=>{:d=>2}}}
p bar # => {:b=>{:c=>{:d=>1}}}

On 13 июн, 07:21, gerbdla  wrote:
> Hi not sure if this is where I should post this problem but since
> upgrading to rails 3.07 dup is not working as expected for Hash
>
> basically in method I have this
>         dup_row = row.dup
>         #then I delete a row of my original hash
>         row[:athlete].delete(:sports) if !row[:athlete][:sports].nil?
>
>    pretty simple but what is happening is it is deleting from the dup
> and the original here is the debug
> code of the original and dup just after deleting the sports
>
> original hash values
>
> {"athlete"=>{"first_name"=>"DaveG5600", "gender"=>"M",
> "hometown_id"=>"40", "birthplace_id"=>"30", "last_name"=>"test"},
> "leagues"=>{"league"=>{"id"=>"821", "start_year"=>"1983",
> "end_year"=>"2003"}}, "clubs"=>{"club"=>[{"id"=>"11802",
> "start_year"=>nil, "end_year"=>nil}, {"id"=>"1403", "start_year"=>nil,
> "end_year"=>nil}]}, "schools"=>{"school"=>{"id"=>nil,
> "start_year"=>nil, "end_year"=>nil}},
> "sports"=>{"sport"=>{"id"=>"102", "start_year"=>"1985",
> "end_year"=>"1986", "sport_roles"=>"10"
>
> dup row (notice sports is missing which even though I am not deleting
> from this hash)
> {"athlete"=>{"first_name"=>"DaveG5600", "gender"=>"M",
> "hometown_id"=>"40", "birthplace_id"=>"30", "last_name"=>"test"},
> "leagues"=>{"league"=>{"id"=>"821", "start_year"=>"1983",
> "end_year"=>"2003"}}, "clubs"=>{"club"=>[{"id"=>"11802",
> "start_year"=>nil, "end_year"=>nil}, {"id"=>"1403", "start_year"=>nil,
> "end_year"=>nil}]}, "schools"=>{"school"=>{"id"=>nil,
> "start_year"=>nil, "end_year"=>nil
>
> row (this is where I expect to have the sport value deleted which is
> does)
> {"athlete"=>{"first_name"=>"DaveG5600", "gender"=>"M",
> "hometown_id"=>"40", "birthplace_id"=>"30", "last_name"=>"test"},
> "leagues"=>{"league"=>{"id"=>"821", "start_year"=>"1983",
> "end_year"=>"2003"}}, "clubs"=>{"club"=>[{"id"=>"11802",
> "start_year"=>nil, "end_year"=>nil}, {"id"=>"1403", "start_year"=>nil,
> "end_year"=>nil}]}, "schools"=>{"school"=>{"id"=>nil,
> "start_year"=>nil, "end_year"=>nil

-- 
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] Need security patches

2011-06-13 Thread seeni khan
Hi All,
I am using rails2.3.4 version ruby version 1.8.7 for my product.My client
suggest me to apply if any security patches (security needs to be fixed in
rails 2.3.4 & ruby 1.8.7) available. I dont know where and how should i find
it.Please suggest me an idea or anyone knows any security patches for the
same.

-- 

*Thanks & Regards,*

*RAFI,*



-- 
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.