[Rails] 2 job openings

2011-07-11 Thread Fred Zahed
Hello everyone,
This is Fred and I am currently working on filling out 2 Ruby on Rail
developer positions in Silicon Valley. US citizen, residents or work
permit only. For detail question feel free to drop me a line at my
email address, fza...@bluechipstaffing.net.

-- 
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 Ruby on Rails Developer

2011-07-11 Thread karthikey...@hrgiants.com
Hi,
 
We have URGENT requirement for an Ruby on Rails Developer in CA. Please send 
me your updated resume along with the contact details.
 
Below are the details for the above said position.
 
 
*Title: Ruby on Rails Developer*

*Job Description: *We are looking for the consultants with the below 
mentioned knowledge

 

Ruby on Rails

MY-SQL

JQery

CSS

 

Thanks,

Karthikeyan.

Ph: 510-870-2315

karthikey...@hrgiants.com

-- 
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/-/aeCAzuAUOfgJ.
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 plugins

2011-07-11 Thread Fernando Almeida
This should be useful for you:
https://gist.github.com/af7e572c2dc973add221

On 12 jul, 03:12, gerbdla  wrote:
> having a bad time trying to get a plugin to work in rails 3 especially
> the Railtie doesn't seem
> to be kicked off.  Do I need to include Railtie class in plugin or
> only in gem?  Maybe
> someone can enlighten me on the how plugins work in Rails 3

--
Fernando Almeida
www.fernandoalmeida.net

-- 
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 3 plugins

2011-07-11 Thread gerbdla
having a bad time trying to get a plugin to work in rails 3 especially
the Railtie doesn't seem
to be kicked off.  Do I need to include Railtie class in plugin or
only in gem?  Maybe
someone can enlighten me on the how plugins work in Rails 3

-- 
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] Date Parsing Puzzlement

2011-07-11 Thread Sayuj Othayoth
your input format is DD/MM/. change this to MM/DD/.

On Tue, Jul 12, 2011 at 6:45 AM, Leigh Daniels wrote:

> Hi All,
>
> When I enter a Start Date in the text field as "07/11/2011" it gets stored
> in the database as "2011-11-07" instead of "2011-07-11".
>
> This change happens before the column is available in the controller. Is
> there some Rails setting that will make this happen magically or do I have
> to have some fun with date parsing?
>
> Thanks!
>
> **Leigh
>
> -
>
> [_form.html.erb]
><%= f.label :start_date, :class => 'label'  %>
><%= f.text_field :start_date, :size => 15 %>
>
> [jobs_controller.rb]
>  def new
>@job = Job.new
>@job.rate = 125
>
>respond_to do |format|
>  format.html # new.html.erb
>  format.json { render json: @job }
>end
>  end
>
> [schema.rb]
>t.date "start_date"
>
>
>
> --
> 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 create dropdown from a hash in rails 3

2011-07-11 Thread shrimpywu

In rails 3, how to create a Dropdown from hash

I have following code in my User class

class User
  ...   other codes
  key :gender, Integer# i use mongo db

  class << self
def genders()# not sure how to define static value, so do in
this way
  genders = {
'1' => 'Male',
'2' => 'Female',
'3' => 'Secret'
  }
end
  end

end

 In the user form, i am trying to create a gender dropdown list
<%= f.collection_select nil, :gender, User.genders, :key, :value %>

 but it complain 
undefined method `merge' for :value:Symbol

 So what is the proper way to create the dropdown?

Thanks

-- 
View this message in context: 
http://old.nabble.com/how-to-create-dropdown-from-a-hash-in-rails-3-tp32043403p32043403.html
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

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

2011-07-11 Thread serusa
HI
   I have a  .js.erb file, like:

(1) $('#ajax-content').html(" here to beigin  ")
(2) $('#ajax-content').append("
  <%= escape_javascript(
   render :partial => 'ajaxnewmsg', :locals =>
{ :privatemsg => @privatemsg }
  ).html_safe
  %>
")
(3) $('#ajax-content').append(" yes finished!")

if without (2) , (1),(3) can show the on the web page with firefox.
But if there is (2),   nothing will show on the ajax-content. I
attached the ajax response from firebug at the end.  ( anything wrong
with that response?)

The question is: what is the best practice to show the complicated
html ( render result)  in .js.erb template?  (render :partial
=> 'ajaxnewmsg', :locals => { :privatemsg => @privatemsg } should be
perfect legal in rails/ruby )

why it  is not working? How could I debug it?



##the response see from firebug
$('#ajax-content').html(" yes I am here to beigin  ")

$('#ajax-content').append("Back to
Inbox<\/a>")

$('#ajax-content').append("
  Back to Inbox<\/a>  \n
\nSend message to :\n<\/h3>\n\n<\/div>\n  \n\n\n\nName <\/b> 
\n  \n  
\n  \n  
\n \n\n\n\n\n\nSubject<\/b>\n\n\n\n\nMessage<\/b>\n<\/ textarea>\n\n\n\n\n\n \n<\/form> ") $('#ajax-content').append(" yes finished!") thanks. Sincerely Min Wang -- 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: Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Rodrigo Ruiz
It uses a method called 'build', which says (to me at least) that it doesn't
exist.

On Mon, Jul 11, 2011 at 10:15 PM, Everaldo Gomes
wrote:

> Take a look in these screencasts:
>
> http://railscasts.com/episodes?utf8=%E2%9C%93&search=model
> http://railscasts.com/episodes/196-nested-model-form-part-1
> http://railscasts.com/episodes/197-nested-model-form-part-2
>
> Maybe they can help you.
>
> Best regards,
>
> Everaldo
>
>
> On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder <
> hassan.schroe...@gmail.com> wrote:
>
>> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz 
>> wrote:
>> > Problem is I want more than one model as I explained before.
>>
>> So each "step" is a different page, different model -- again, what is
>> the issue? Complete one, go to the next.
>>
>> --
>> Hassan Schroeder  hassan.schroe...@gmail.com
>> http://about.me/hassanschroeder
>> twitter: @hassan
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-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] Re: Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Rodrigo Ruiz
I want to save all together, not step by step. Or all saves, or none of them
goes to the database

On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder <
hassan.schroe...@gmail.com> wrote:

> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz 
> wrote:
> > Problem is I want more than one model as I explained before.
>
> So each "step" is a different page, different model -- again, what is
> the issue? Complete one, go to the next.
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-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] Re: is Rack right for this?

2011-07-11 Thread BryanD
I've been using Sinatra for API stuff lately and love it. In
particular I've been getting great results with async Sinatra via Kyle
Drake's Sammy Davis Junior boilerplate.  I'm on a mobile device now,
otherwise I'd give you a link.

You could just write your own rack app, but that's probably not
necessary.

Another thing to check out is Goliath.


On Jul 11, 7:51 pm, Bill Walton  wrote:
> Greetings,
>
> My 2.3.2 app has 2 components.  It serves a browser-based client, and
> it serves a web service client.  Each client has its own set of
> controllers to separate authentication / authorization cleanly and
> clearly.  The web service client sends gets, posts, and puts, some
> with xml bodies, and the app responds with status / location and xml
> bodies where appropriate.  I'm in the beginning stages of moving the
> app to Rails 3.  One thing I'd like to accomplish is to reduce the
> start-up overhead associated with the web service requests if
> possible.  I really don't need / use the erb functionality in
> constructing the responses, for example.  The thing I don't have my
> arms around at this point is how to get the controller and model
> 'stuff' loaded without the bulk of the view 'stuff'.'  Anybody got any
> experience / insight to share.  I don't seem to have my google fu in
> order.
>
> Thanks,
> Bill

-- 
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] is Rack right for this?

2011-07-11 Thread Bill Walton
Greetings,

My 2.3.2 app has 2 components.  It serves a browser-based client, and
it serves a web service client.  Each client has its own set of
controllers to separate authentication / authorization cleanly and
clearly.  The web service client sends gets, posts, and puts, some
with xml bodies, and the app responds with status / location and xml
bodies where appropriate.  I'm in the beginning stages of moving the
app to Rails 3.  One thing I'd like to accomplish is to reduce the
start-up overhead associated with the web service requests if
possible.  I really don't need / use the erb functionality in
constructing the responses, for example.  The thing I don't have my
arms around at this point is how to get the controller and model
'stuff' loaded without the bulk of the view 'stuff'.'  Anybody got any
experience / insight to share.  I don't seem to have my google fu in
order.

Thanks,
Bill

-- 
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] Date Parsing Puzzlement

2011-07-11 Thread Leigh Daniels
Hi All,

When I enter a Start Date in the text field as "07/11/2011" it gets stored in 
the database as "2011-11-07" instead of "2011-07-11".

This change happens before the column is available in the controller. Is there 
some Rails setting that will make this happen magically or do I have to have 
some fun with date parsing?

Thanks!

**Leigh

-

[_form.html.erb]
<%= f.label :start_date, :class => 'label'  %>
<%= f.text_field :start_date, :size => 15 %>

[jobs_controller.rb]
  def new
@job = Job.new
@job.rate = 125

respond_to do |format|
  format.html # new.html.erb
  format.json { render json: @job }
end
  end

[schema.rb]
t.date "start_date"



-- 
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: Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Everaldo Gomes
Take a look in these screencasts:

http://railscasts.com/episodes?utf8=%E2%9C%93&search=model
http://railscasts.com/episodes/196-nested-model-form-part-1
http://railscasts.com/episodes/197-nested-model-form-part-2

Maybe they can help you.

Best regards,

Everaldo

On Mon, Jul 11, 2011 at 10:11 PM, Hassan Schroeder <
hassan.schroe...@gmail.com> wrote:

> On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz 
> wrote:
> > Problem is I want more than one model as I explained before.
>
> So each "step" is a different page, different model -- again, what is
> the issue? Complete one, go to the next.
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-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: Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Hassan Schroeder
On Mon, Jul 11, 2011 at 5:55 PM, Rodrigo Ruiz  wrote:
> Problem is I want more than one model as I explained before.

So each "step" is a different page, different model -- again, what is
the issue? Complete one, go to the next.

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Rodrigo Ruiz
Problem is I want more than one model as I explained before.

On Tuesday, July 12, 2011, Hassan Schroeder  wrote:
> On Mon, Jul 11, 2011 at 4:15 PM, Rodrigo Ruiz  wrote:
>> I watched the screencast, and it covers the multi step form thing but
>> with only one model.
>> I'd like to the the same thing but each step would be a different
>> model. How can I do that?
>
> 1 page, 1 form, 1 model -- sounds typical; what's the problem?
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-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] Re: Pre-populating association

2011-07-11 Thread Christopher Thielen
I was able to resolve this problem. For those curious: 
http://stackoverflow.com/questions/6656872/activerecord-building-for-nested-resource

On Jul 11, 2011, at 11:09 AM, Christopher Thielen wrote:

> I think this is related to 
> http://stackoverflow.com/questions/5914736/rails-3-undefined-method-model-name-for-arrayclass
>  .
> 
> I decided to change my ../ballot/new controller to:
> 
> def new
>@survey = Survey.find(params[:survey_id])
> 
>@ballot = @survey.ballots.build
> 
># Prepare the ballot
>@ballot.preferences = @survey.questions.map{|question| 
> question.preferences.build}
>#for question in @ballot.survey.questions
>#  p = Preference.new
>#  p.ballot = @ballot
>#  p.question = question
>#  @ballot.preferences << p
>#end
> 
>respond_to do |format|
>  format.html # new.html.erb
>  format.xml  { render :xml => @ballot }
>end
>  end
> 
> And the new view to:
> 
> <%= form_for [@survey, @ballot] do |f| %>
>  <%=h @ballot.preferences[0].question.inspect %>
> 
>  <%= f.fields_for @ballot.preferences do |preference_form| %>
><%= preference_form.fields_for :question do |question_form| %>
>  
>   <%= question_form.label :question %>
>   <%= radio_button("preference", "preference", "Yes") %> Yes
>   <%= radio_button("preference", "preference", "No") %> No
>   <%= radio_button("preference", "preference", "Decline") %> Decline
>  
><% end %>
>  <% end %>
> 
>  
><%= f.submit "Vote" %>
>  
> <% end %>
> 
> And now I receive the error:
> undefined method `model_name' for Array:Class
> 
> for the fields_for line.
> 
> My guess is @ballot.preferences isn't a proper set of instances but just an 
> array, though my Ruby on Rails skills aren't good enough to figure this out. 
> Any ideas?
> 
> On Jul 10, 2011, at 11:14 PM, Christopher Thielen wrote:
> 
>> Hello,
>> 
>> I think this is an easy one for the average Rails developer but I'm a bit 
>> stuck.
>> 
>> I'm creating a simple voting app: any user can create a survey, with any 
>> number of questions, and other users can then vote by creating a ballot for 
>> that survey.
>> 
>> Here's the modeling:
>> 
>> class Survey < ActiveRecord::Base
>> has_many :questions
>> has_many :eligibilities
>> has_many :ballots
>> 
>> accepts_nested_attributes_for :questions, :allow_destroy => true
>> 
>> attr_accessible :title, :description, :status, :deadline, 
>> :questions_attributes
>> 
>> def owner
>>   Person.find(owner_id)
>> end
>> end
>> 
>> class Question < ActiveRecord::Base
>> belongs_to :survey
>> has_many :preferences
>> end
>> 
>> class Ballot < ActiveRecord::Base
>> belongs_to :survey
>> has_many :preferences
>> end
>> 
>> class Preference < ActiveRecord::Base
>> belongs_to :ballot
>> belongs_to :question
>> end
>> 
>> To be clear: a survey is the set of questions and a ballot is a voter's set 
>> of answers (preferences).
>> 
>> I'm using the nested route: /surveys/[:survey_id]/ballot/new for the voting 
>> page.
>> 
>> What I'm having trouble with is pre-populating the ballot with empty 
>> preferences. When ballot/new is called, I do this:
>> 
>> def new
>>   @survey = Survey.find(params[:survey_id])
>> 
>>   @ballot = @survey.ballots.build
>> 
>>   # Prepare the ballot
>>   for question in @ballot.survey.questions
>> p = Preference.new
>> p.ballot = @ballot
>> p.question = question
>> @ballot.preferences << p
>>   end
>> 
>>   respond_to do |format|
>> format.html # new.html.erb
>> format.xml  { render :xml => @ballot }
>>   end
>> end
>> 
>> and on the ballot/new.html.erb page, I try this:
>> 
>> <%= form_for [@survey, @ballot] do |f| %>
>> <%= f.fields_for :preferences do |preference_form| %>
>>   <%= preference_form.fields_for :question do |question_form| %>
>> 
>>  <%= question_form.label :question %>
>>  <%= radio_button("preference", "preference", "Yes") %> Yes
>>  <%= radio_button("preference", "preference", "No") %> No
>>  <%= radio_button("preference", "preference", "Decline") %> Decline
>> 
>>   <% end %>
>> <% end %>
>> 
>> 
>>   <%= f.submit "Vote" %>
>> 
>> <% end %>
>> 
>> But this merely shows one set of radio buttons with no question text, though 
>> I've confirmed the @survey.questions are populated with questions.
>> 
>> Does anybody see what I'm doing wrong here? My guess is looking at the 
>> new.html.erb is going to really show off something incorrect.
>> 
>> Christopher Thielen
> 

-- 
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: Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Hassan Schroeder
On Mon, Jul 11, 2011 at 4:15 PM, Rodrigo Ruiz  wrote:
> I watched the screencast, and it covers the multi step form thing but
> with only one model.
> I'd like to the the same thing but each step would be a different
> model. How can I do that?

1 page, 1 form, 1 model -- sounds typical; what's the problem?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Rodrigo Ruiz
I watched the screencast, and it covers the multi step form thing but
with only one model.
I'd like to the the same thing but each step would be a different
model. How can I do that?


On Monday, July 11, 2011, Everaldo Gomes  wrote:
> Hi Rodrigo,
>
> Take a look at this screencast, from Ryan Bates: 
> http://railscasts.com/episodes/217-multistep-forms
>
>
> Best Regards,
>
> Everaldo
>
>
> On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz  wrote:
>
>
> Do you know when you are filling out a registration for a new account, and 
> you keep pressing next to fill the rest of the information in separate pages?
> I'd like to do that, but I have no idea how.
>
>
>
> Basically I have a company model with its information, and a contacts model, 
> with belongs to my company (also each company has only one contact), and I'd 
> like for the user to fill in the company specific information (like email, 
> name, address, etc), and click next down the page to fill in the contact 
> information (telephone, manager email, etc). Also I'd like to save it to the 
> database only if all the information in both pages are inputed.
>
>
>
> Thank you,Rodrigo
>
>
>
>
> --
> 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] Re: Duplicate Record Detection

2011-07-11 Thread Justin Stanczak
Yes, this is very nice.

On Mon, Jul 11, 2011 at 5:04 PM, Hassan Schroeder <
hassan.schroe...@gmail.com> wrote:

> On Mon, Jul 11, 2011 at 1:56 PM, pepe  wrote:
> > Whenever I have worked on similar projects in ended up being the
> > customer's idea of what a "close approximation" was that made a
> > possible duplicate.
>
> Exactly -- if they're not *identical* they're not "duplicates".
>
> On the other hand if you define "similarity" to some degree you can use
> e.g. the Levenshtein gem to measure how "different" 2 given fields are.
>
> > Levenshtein.distance("Hassan Schroeder", "Hassan A. Schroeder")
>  => 3
>
> HTH!
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-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: Duplicate Record Detection

2011-07-11 Thread Hassan Schroeder
On Mon, Jul 11, 2011 at 1:56 PM, pepe  wrote:
> Whenever I have worked on similar projects in ended up being the
> customer's idea of what a "close approximation" was that made a
> possible duplicate.

Exactly -- if they're not *identical* they're not "duplicates".

On the other hand if you define "similarity" to some degree you can use
e.g. the Levenshtein gem to measure how "different" 2 given fields are.

> Levenshtein.distance("Hassan Schroeder", "Hassan A. Schroeder")
 => 3

HTH!
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

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

2011-07-11 Thread pepe
Whenever I have worked on similar projects in ended up being the
customer's idea of what a "close approximation" was that made a
possible duplicate. It was usually something like:
  same birth date
  same last name
  same city (optional)
  same state (optional)

Since there is not such a thing as a tried and true method for what a
duplicate record is I believe you'll just need to do some manual work.
My advise would be to ask your customer/boss for what the rules are.

On Jul 11, 4:29 pm, Justin Stanczak  wrote:
> Yes, this is all very true. I was thinking if a comparison was done on
> multiple attributes that would help with just one name being wrong. I'm not
> looking for magic, just wondering how others find duplicated records. I
> could see this being used to detect data that links or is similar in nature.
>
> Found this as 
> well.http://en.wikipedia.org/wiki/User:Ipeirotis/Duplicate_Record_Detection
>
>
>
>
>
>
>
> On Mon, Jul 11, 2011 at 4:17 PM, pepe  wrote:
> > I don't believe you're going to find a magic formula for what you're
> > suggesting. The same thing could be said about last or first names as
> > you are suggesting could happen with SSNs. What if somebody misspells
> > Smith for Smit, for example? But worse yet, what if it is not a
> > misspelling situation and the Smit is actually Smit? The same is true
> > for SSNs, switching the last 2 digits does not mean it was a
> > "misspell", it could just be that 2 different people have the same
> > name and very similar SSNs. You have to draw a line somewhere, I
> > think.
>
> > You could use auto-complete fields and then provide options based on
> > records found using the 'LIKE' option in the where clause using the
> > information currently being entered. That might help but I think
> > you'll find it's not worth the effort.

-- 
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] Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Rodrigo Ruiz
Thank you very much, I'm watching the video right now, but I think this is
exactly what I was looking for

On Mon, Jul 11, 2011 at 4:12 PM, Everaldo Gomes wrote:

> Hi Rodrigo,
>
> Take a look at this screencast, from Ryan Bates:
> http://railscasts.com/episodes/217-multistep-forms
>
>
> Best Regards,
>
> Everaldo
>
>
> On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz wrote:
>
>> Do you know when you are filling out a registration for a new account, and
>> you keep pressing next to fill the rest of the information in separate
>> pages?
>>
>> I'd like to do that, but I have no idea how.
>>
>> Basically I have a company model with its information, and a contacts
>> model, with belongs to my company (also each company has only one contact),
>> and I'd like for the user to fill in the company specific information (like
>> email, name, address, etc), and click next down the page to fill in the
>> contact information (telephone, manager email, etc). Also I'd like to save
>> it to the database only if all the information in both pages are inputed.
>>
>> Thank you,
>> Rodrigo
>>
>>  --
>> 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] Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Rodrigo Ruiz
thank you

On Mon, Jul 11, 2011 at 4:20 PM, Walter Lee Davis wrote:

> And just FYI, multi-tenant usually means that you have one database
> containing separate (unrelated) client accounts, for example Basecamp. There
> isn't a separate database for my Basecamp account and yours, our records are
> all commingled in one set of tables, and the server enforces business rules
> to make sure I don't see your messages and vice-versa.
>
> Walter
>
>
> On Jul 11, 2011, at 3:12 PM, Everaldo Gomes wrote:
>
>  Hi Rodrigo,
>>
>> Take a look at this screencast, from Ryan Bates: http://railscasts.com/**
>> episodes/217-multistep-forms
>>
>>
>> Best Regards,
>>
>> Everaldo
>>
>>
>> On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz 
>> wrote:
>> Do you know when you are filling out a registration for a new account, and
>> you keep pressing next to fill the rest of the information in separate
>> pages?
>>
>> I'd like to do that, but I have no idea how.
>>
>> Basically I have a company model with its information, and a contacts
>> model, with belongs to my company (also each company has only one contact),
>> and I'd like for the user to fill in the company specific information (like
>> email, name, address, etc), and click next down the page to fill in the
>> contact information (telephone, manager email, etc). Also I'd like to save
>> it to the database only if all the information in both pages are inputed.
>>
>> Thank you,
>> Rodrigo
>>
>>
>> --
>> 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+unsubscribe@**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+unsubscribe@**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+unsubscribe@**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: Duplicate Record Detection

2011-07-11 Thread Justin Stanczak
Yes, this is all very true. I was thinking if a comparison was done on
multiple attributes that would help with just one name being wrong. I'm not
looking for magic, just wondering how others find duplicated records. I
could see this being used to detect data that links or is similar in nature.

Found this as well.
http://en.wikipedia.org/wiki/User:Ipeirotis/Duplicate_Record_Detection

On Mon, Jul 11, 2011 at 4:17 PM, pepe  wrote:

> I don't believe you're going to find a magic formula for what you're
> suggesting. The same thing could be said about last or first names as
> you are suggesting could happen with SSNs. What if somebody misspells
> Smith for Smit, for example? But worse yet, what if it is not a
> misspelling situation and the Smit is actually Smit? The same is true
> for SSNs, switching the last 2 digits does not mean it was a
> "misspell", it could just be that 2 different people have the same
> name and very similar SSNs. You have to draw a line somewhere, I
> think.
>
> You could use auto-complete fields and then provide options based on
> records found using the 'LIKE' option in the where clause using the
> information currently being entered. That might help but I think
> you'll find it's not worth the effort.
>
>

-- 
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: Duplicate Record Detection

2011-07-11 Thread Justin Stanczak
It would stop duplication of that unique string, but not fix a typo like
transposed numbers. Besides, that was a simple example, not meant to be
challenged. It's the process of detecting duplicates, I'm looking for. I
know how to validate and key tables. Maybe another example is loading a
million records from external source, and you need to find duplicates. I'm
just asking if anyone has seen api's or ruby utilities that preform this
function. Like SimString it seems to compare how close to strings are to
matching.



On Mon, Jul 11, 2011 at 4:02 PM, Hassan Schroeder <
hassan.schroe...@gmail.com> wrote:

> On Mon, Jul 11, 2011 at 9:42 AM, Justin Stanczak 
> wrote:
> > That would help slow the duplication, but if someone fills out a form and
> > submits fname, lname, ss#, and they typo the ss# I would have a
> duplicate.
>
> "slow the duplication"?? No, insuring that the SSNs *are unique* via
> validations and unique indexes would prevent duplicates, period.
>
> What is it about that you don't like?
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-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] Re: Duplicate Record Detection

2011-07-11 Thread pepe
I don't believe you're going to find a magic formula for what you're
suggesting. The same thing could be said about last or first names as
you are suggesting could happen with SSNs. What if somebody misspells
Smith for Smit, for example? But worse yet, what if it is not a
misspelling situation and the Smit is actually Smit? The same is true
for SSNs, switching the last 2 digits does not mean it was a
"misspell", it could just be that 2 different people have the same
name and very similar SSNs. You have to draw a line somewhere, I
think.

You could use auto-complete fields and then provide options based on
records found using the 'LIKE' option in the where clause using the
information currently being entered. That might help but I think
you'll find it's not worth the effort.

On Jul 11, 12:42 pm, Justin Stanczak  wrote:
> That would help slow the duplication, but if someone fills out a form and
> submits fname, lname, ss#, and they typo the ss# I would have a duplicate. I
> would like to display to admin users that this record has a related link, or
> is similar. Similar to how Google finds duplicates in your contacts and
> merges them.
>
>
>
>
>
>
>
> On Mon, Jul 11, 2011 at 12:25 PM, pepe  wrote:
> > validate_uniqueness_of might be of help?
>
> > On Jul 10, 6:21 pm, Justin Stanczak  wrote:
> > > How are others doing duplicate record detection? I'm not finding very
> > many
> > > solutions, or methods online. I found one called SimString, but not much
> > > else. I was wondering how others are detecting duplicates. Similar to
> > > suggested items, I would like to show records that may match or have
> > similar
> > > attributes.
>
> > --
> > 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: Duplicate Record Detection

2011-07-11 Thread Hassan Schroeder
On Mon, Jul 11, 2011 at 9:42 AM, Justin Stanczak  wrote:
> That would help slow the duplication, but if someone fills out a form and
> submits fname, lname, ss#, and they typo the ss# I would have a duplicate.

"slow the duplication"?? No, insuring that the SSNs *are unique* via
validations and unique indexes would prevent duplicates, period.

What is it about that you don't like?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Walter Lee Davis
And just FYI, multi-tenant usually means that you have one database  
containing separate (unrelated) client accounts, for example Basecamp.  
There isn't a separate database for my Basecamp account and yours, our  
records are all commingled in one set of tables, and the server  
enforces business rules to make sure I don't see your messages and  
vice-versa.


Walter

On Jul 11, 2011, at 3:12 PM, Everaldo Gomes wrote:


Hi Rodrigo,

Take a look at this screencast, from Ryan Bates: 
http://railscasts.com/episodes/217-multistep-forms


Best Regards,

Everaldo


On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz  
 wrote:
Do you know when you are filling out a registration for a new  
account, and you keep pressing next to fill the rest of the  
information in separate pages?


I'd like to do that, but I have no idea how.

Basically I have a company model with its information, and a  
contacts model, with belongs to my company (also each company has  
only one contact), and I'd like for the user to fill in the company  
specific information (like email, name, address, etc), and click  
next down the page to fill in the contact information (telephone,  
manager email, etc). Also I'd like to save it to the database only  
if all the information in both pages are inputed.


Thank you,
Rodrigo


--
You received this message because you are subscribed to the Google  
Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails- 
t...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en 
.



--
You received this message because you are subscribed to the Google  
Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails- 
t...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en 
.


--
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: Preventing serialization of attributes in the model

2011-07-11 Thread jhaagmans
Hi Peter,

Your suggestion will work fine. Thank you. I was hoping there would be
a way to do this within ActiveModel or ActiveRecord because I also
want to do this the other way around: I would like to render some
javascript in which can dynamically define these attributes. I'll have
to do that with some kind of model variable or method.

Jaap Haagmans


On 10 jul, 18:37, Peter De Berdt  wrote:
> Overwriting the "as_json" method in your model should work too I  
> think. Best way to to it IMO if it's just one model you want to change  
> the to_json behavior on.
>
> def as_json(options={})
>    options[:except] ||= [:some, :fields, :here]
>    super(options)
> end
>
> On 10 Jul 2011, at 17:35, Everaldo Gomes wrote:
>
>
>
>
>
>
>
>
>
> > I think you could use inheritance to extend ActiveRecord::Base and  
> > then you could overwrite the to_json method.
>
> > There you could write the rules for default excluded column names.
>
> > Then, your Models should extend your inherited class.
>
> > I don't know if this work, it's just an idea.
>
> > Best Regards,
>
> > Everaldo
>
> > On Sun, Jul 10, 2011 at 12:01 PM, jhaagmans  
> >  wrote:
> > Hi,
>
> > I'd like to get your thoughts on something. We're developing an
> > application that relies heavily RESTful JSON requests.
>
> > Because I want to keep the code as clean as possible, I want to be
> > able to return the JSON for a user using @user.to_json. Which works
> > fine, but it also includes the crypted_password data and the
> > persistence_token, among other things.
>
> > What I do now to prevent this from happening is including an :except
> > option for the to_json method in my controller for these sensitive
> > columns, but I'd like to know whether there is a way to specify the
> > excluded columns somewhere in the model to prevent serialization of
> > these attributes.
>
> > If that's possible I'd also like to know whether there's a way to
> > check for this prevention so that we can dynamically generate relevant
> > column names (for example).
>
> 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.



Re: [Rails] Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Everaldo Gomes
Hi Rodrigo,

Take a look at this screencast, from Ryan Bates:
http://railscasts.com/episodes/217-multistep-forms


Best Regards,

Everaldo


On Mon, Jul 11, 2011 at 2:41 PM, Rodrigo Ruiz wrote:

> Do you know when you are filling out a registration for a new account, and
> you keep pressing next to fill the rest of the information in separate
> pages?
>
> I'd like to do that, but I have no idea how.
>
> Basically I have a company model with its information, and a contacts
> model, with belongs to my company (also each company has only one contact),
> and I'd like for the user to fill in the company specific information (like
> email, name, address, etc), and click next down the page to fill in the
> contact information (telephone, manager email, etc). Also I'd like to save
> it to the database only if all the information in both pages are inputed.
>
> Thank you,
> Rodrigo
>
>  --
> 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] when iterating tables with ActiveRecord::Base.connection, how do you check if a string is equal to the current table iteration?

2011-07-11 Thread Frederick Cheung


On 11 Jul 2011, at 17:51, John Merlino  wrote:

> Hey all,
> 
> This here is not working:
> 
> task(:load_selected => :load_config) do
>   IgnoreTables = %w('students')

I think you'll find that this array is ["'students'"] but you expected it to be 
["students"]

Fred
>  begin
>   ActiveRecord::Base.establish_connection
>   ActiveRecord::Base.connection.tables.each do |table|
>  if IgnoreTables.include? table
>puts "Its true"
>next
>  else
>ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
>  end
> 
> end
>   end
> end
> 
> Despite that some point table will be equal to students and students
> is in the IgnoreTables array, it should skip to the next iteration,
> but rather the else is triggered and the table is truncated.
> 
> Anyway know how to address this? Is there a method part of connection
> that will help me achieve what I am trying to do?
> 
> Thanks for response
> 
> -- 
> 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: has_many and belongs_to association

2011-07-11 Thread Frederick Cheung


On 11 Jul 2011, at 17:59, Yennie  wrote:

> 
> 
> On Jul 11, 12:13 pm, Colin Law  wrote:
>> On 11 July 2011 17:05, Yennie  wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi ,
>> 
>>> I want to test the one below but I got the problem
>> 
>>>  belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
>> 
>>> in my test
>>> context "test"do
>>>   should have_many :phrases
>>> end
>> 
>>> in language.rb
>>>  belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
>> 
>>> error is
>> 
>>>  1) Failure:
>>> test: check has_many and belongs_to  association should have many
>>> languages. (PhraseTest) [/usr/local/lib/ruby/gems/1.9.1/gems/
>>> shoulda-2.11.3/lib/shoulda/context.rb:324]:
>>> Expected Phrase to have a has_many association called languages
>>> (Language does not have a phrase_id foreign key.).
>>> Expected block to return true value.
>> 
>>> I dont really understand what it's warning now..
>> 
>> It might help us if you showed us the failing test.  Also I think it
>> would be better to use name_id as the foreign key for language
>> belongs_to :name.
>> 
> 
>> Colin
> 
> model language.rb
> class Language < ActiveRecord::Base
> belongs_to :phraes, :class_name => "Phrase", :foreign_key => "name"
> end
> 
> model phrase.rb
> has_many :phrases, :class_name => "Phrase", :foreign_key =>
> "category_id"
>  belongs_to :category, :class_name => "Phrase"
> 
>  has_many :languages
> end
> 
> test file phrase_test.rb
> context "check has_many and belongs_to  association" do
>   should belong_to :category
>   should have_many :phrases
>   should have_many :languages
> end
> 
> error
> 
> Started
> ..F...
> Finished in 1.313199 seconds.
> 
>  1) Failure:
> test: check has_many and belongs_to  association should have many
> languages. (PhraseTest) [/usr/local/lib/ruby/gems/1.9.1/gems/
> shoulda-2.11.3/lib/shoulda/context.rb:324]:
> Expected Phrase to have a has_many association called languages
> (Language does not have a phrase_id foreign key.).
> Expected block to return true value
> 
The test claims to be failing because the languages table does not have a 
phrase_id column. Does it?

Fred


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

-- 
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: Coffee script not working on Rails 3.1.rc4

2011-07-11 Thread Gustavo de Sá Carvalho Honorato
Note that: this error only happens in production mode.

2011/7/6 Gustavo de Sá Carvalho Honorato 

>
> On Tue, Jul 5, 2011 at 8:27 PM, David Zhang  wrote:
>
>> I'm using Rails 3.1.rc4 with ruby 1.9.2, and I just made a new app to test
>> this out.  I ran your exact commands, except I used the standard sqlite3
>> development db.  I did not get any errors - the scaffold worked fine, and so
>> does creating users.
>>
>> Maybe it's an SQL development database issue - e.g. is your db properly
>> created/configured and everything?
>
>
> David,  everything is OK in my database. I'm suspecting that ExecJS uses
> some native extension that is not working very well on my system.
>
>>  --
>> 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/-/Wv44E-Hpf0kJ.
>> 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] Re: Pre-populating association

2011-07-11 Thread Christopher Thielen
I think this is related to 
http://stackoverflow.com/questions/5914736/rails-3-undefined-method-model-name-for-arrayclass
 .

I decided to change my ../ballot/new controller to:

def new
@survey = Survey.find(params[:survey_id])

@ballot = @survey.ballots.build

# Prepare the ballot
@ballot.preferences = @survey.questions.map{|question| 
question.preferences.build}
#for question in @ballot.survey.questions
#  p = Preference.new
#  p.ballot = @ballot
#  p.question = question
#  @ballot.preferences << p
#end

respond_to do |format|
  format.html # new.html.erb
  format.xml  { render :xml => @ballot }
end
  end

And the new view to:

<%= form_for [@survey, @ballot] do |f| %>
  <%=h @ballot.preferences[0].question.inspect %>

  <%= f.fields_for @ballot.preferences do |preference_form| %>
<%= preference_form.fields_for :question do |question_form| %>
  
<%= question_form.label :question %>
<%= radio_button("preference", "preference", "Yes") %> Yes
<%= radio_button("preference", "preference", "No") %> No
<%= radio_button("preference", "preference", "Decline") %> Decline
  
<% end %>
  <% end %>

  
<%= f.submit "Vote" %>
  
<% end %>

And now I receive the error:
undefined method `model_name' for Array:Class

for the fields_for line.

My guess is @ballot.preferences isn't a proper set of instances but just an 
array, though my Ruby on Rails skills aren't good enough to figure this out. 
Any ideas?

On Jul 10, 2011, at 11:14 PM, Christopher Thielen wrote:

> Hello,
> 
> I think this is an easy one for the average Rails developer but I'm a bit 
> stuck.
> 
> I'm creating a simple voting app: any user can create a survey, with any 
> number of questions, and other users can then vote by creating a ballot for 
> that survey.
> 
> Here's the modeling:
> 
> class Survey < ActiveRecord::Base
>  has_many :questions
>  has_many :eligibilities
>  has_many :ballots
> 
>  accepts_nested_attributes_for :questions, :allow_destroy => true
> 
>  attr_accessible :title, :description, :status, :deadline, 
> :questions_attributes
> 
>  def owner
>Person.find(owner_id)
>  end
> end
> 
> class Question < ActiveRecord::Base
>  belongs_to :survey
>  has_many :preferences
> end
> 
> class Ballot < ActiveRecord::Base
>  belongs_to :survey
>  has_many :preferences
> end
> 
> class Preference < ActiveRecord::Base
>  belongs_to :ballot
>  belongs_to :question
> end
> 
> To be clear: a survey is the set of questions and a ballot is a voter's set 
> of answers (preferences).
> 
> I'm using the nested route: /surveys/[:survey_id]/ballot/new for the voting 
> page.
> 
> What I'm having trouble with is pre-populating the ballot with empty 
> preferences. When ballot/new is called, I do this:
> 
> def new
>@survey = Survey.find(params[:survey_id])
> 
>@ballot = @survey.ballots.build
> 
># Prepare the ballot
>for question in @ballot.survey.questions
>  p = Preference.new
>  p.ballot = @ballot
>  p.question = question
>  @ballot.preferences << p
>end
> 
>respond_to do |format|
>  format.html # new.html.erb
>  format.xml  { render :xml => @ballot }
>end
>  end
> 
> and on the ballot/new.html.erb page, I try this:
> 
> <%= form_for [@survey, @ballot] do |f| %>
>  <%= f.fields_for :preferences do |preference_form| %>
><%= preference_form.fields_for :question do |question_form| %>
>  
>   <%= question_form.label :question %>
>   <%= radio_button("preference", "preference", "Yes") %> Yes
>   <%= radio_button("preference", "preference", "No") %> No
>   <%= radio_button("preference", "preference", "Decline") %> Decline
>  
><% end %>
>  <% end %>
> 
>  
><%= f.submit "Vote" %>
>  
> <% end %>
> 
> But this merely shows one set of radio buttons with no question text, though 
> I've confirmed the @survey.questions are populated with questions.
> 
> Does anybody see what I'm doing wrong here? My guess is looking at the 
> new.html.erb is going to really show off something incorrect.
> 
> Christopher Thielen

-- 
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] stuck with permissions in using FileUtils

2011-07-11 Thread Erwin
Even if I am using PaperClip & Delayed_job, I guess the issue maybe
solved by FileUtisl gurus ...

here is the case :

I am testing a delayed video format transcoding , transcoding works
perfectly but I get an issue -trying to write back the transcoded
video from a tmp directory into the PaperClip path

the original uploaded video file is stored into the   :url => "/system/
clips/:data/65/original/swing.avi",

in the delayed_job, I get  the clip :
   clip = Clip.find(65)
  @clip_file = clip.data.path #   =>  ( ".. rails/myapp/public/
system/clips/data/65/original/NickFaldo.avi" )
  @clip_dir = File.dirname(@clip_file) #  =>  (".. /ls/myapp/
public/system/clips/data/65/original" )
  basename = File.basename(@clip_file, File.extname(@clip_file))
# => NickFaldo

the ffmpeg transcoding process, is writing an output file into the tmp
dir , without any problem
  @tmp_dir = FileUtils.mkdir_p(Rails.root.join("tmp", "converted",
"#{clip[:id]}"))#   =>  ( "../clips/tmp/65i" )
  @tmp_file = File.join(@tmp_dir, "#{basename}.mp4")#  =>
( "../clips/tmp/65/NickFaldo.mp4" )

until then everything works as expected ...

then I want to bring back the transcoded clip in place of the original
one ... with the same base name but with an .mp4 extension
  @converted_file = File.join(File.dirname(@clip_file),
"#{basename}.mp4" )  #   =>  ( ".. rails/myapp/public/system/clips/
data/65/original/NickFaldo.mp4" )

so I wrote :
FileUtils.rm @clip_file  # remove clip_file# to remove
the previous original
FileUtils.chmod(0777, @clip_dir )
FileUtils.cp @tmp_file, @converted_file  #  copy
transcoded file as  new  original
FileUtils.rm_r @tmp_dir #
remove tmp directory

but I get anexception raised
( not being root I believe I can't change the permissions and write
into the PaperClip path for this clip 

any suggestion will be welcome ... 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] Help filling out a registration (I think it's called multi tenant)

2011-07-11 Thread Rodrigo Ruiz
Do you know when you are filling out a registration for a new account, and
you keep pressing next to fill the rest of the information in separate
pages?

I'd like to do that, but I have no idea how.

Basically I have a company model with its information, and a contacts model,
with belongs to my company (also each company has only one contact), and I'd
like for the user to fill in the company specific information (like email,
name, address, etc), and click next down the page to fill in the contact
information (telephone, manager email, etc). Also I'd like to save it to the
database only if all the information in both pages are inputed.

Thank you,
Rodrigo

-- 
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: Help with modules and subfolders

2011-07-11 Thread Rodrigo Ruiz
Can anyone help me with that please?

On Sat, Jul 9, 2011 at 11:34 AM, Rodrigo Ruiz wrote:

> My project is starting to have a lot of classes, and I'd like to organize
> them.
> I have mainly 3 mini websites within my project, one for companies (that
> will sell something), one for users (that will buy), and one for admin.
>
> I can imagine 2 ways of organizing it: include (or require, I don't really
> know what to use in this case) each group into a module, that way I'd have 3
> modules, companies, users and admin; or just create subfolders and puts the
> classes there, but I don't know if it will still work the same way it used
> to.
>
> So I'd like some help to find out what is the best way to organize my
> project. Cause If I don't do anything, all the controllers (for example)
> will just be there in the controllers folder.
>
> Thank you,
> Rodrigo
>

-- 
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: has_many and belongs_to association

2011-07-11 Thread Yennie


On Jul 11, 12:13 pm, Colin Law  wrote:
> On 11 July 2011 17:05, Yennie  wrote:
>
>
>
>
>
>
>
>
>
> > Hi ,
>
> > I want to test the one below but I got the problem
>
> >  belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
>
> > in my test
> > context "test"do
> >   should have_many :phrases
> > end
>
> > in language.rb
> >  belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
>
> > error is
>
> >  1) Failure:
> > test: check has_many and belongs_to  association should have many
> > languages. (PhraseTest) [/usr/local/lib/ruby/gems/1.9.1/gems/
> > shoulda-2.11.3/lib/shoulda/context.rb:324]:
> > Expected Phrase to have a has_many association called languages
> > (Language does not have a phrase_id foreign key.).
> > Expected block to return true value.
>
> > I dont really understand what it's warning now..
>
> It might help us if you showed us the failing test.  Also I think it
> would be better to use name_id as the foreign key for language
> belongs_to :name.
>

> Colin

model language.rb
class Language < ActiveRecord::Base
belongs_to :phraes, :class_name => "Phrase", :foreign_key => "name"
end

model phrase.rb
 has_many :phrases, :class_name => "Phrase", :foreign_key =>
"category_id"
  belongs_to :category, :class_name => "Phrase"

  has_many :languages
end

test file phrase_test.rb
 context "check has_many and belongs_to  association" do
   should belong_to :category
   should have_many :phrases
   should have_many :languages
end

error

Started
..F...
Finished in 1.313199 seconds.

  1) Failure:
test: check has_many and belongs_to  association should have many
languages. (PhraseTest) [/usr/local/lib/ruby/gems/1.9.1/gems/
shoulda-2.11.3/lib/shoulda/context.rb:324]:
Expected Phrase to have a has_many association called languages
(Language does not have a phrase_id foreign key.).
Expected block to return true value


plz help .. 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] when iterating tables with ActiveRecord::Base.connection, how do you check if a string is equal to the current table iteration?

2011-07-11 Thread John Merlino
Hey all,

This here is not working:

 task(:load_selected => :load_config) do
   IgnoreTables = %w('students')
  begin
   ActiveRecord::Base.establish_connection
   ActiveRecord::Base.connection.tables.each do |table|
  if IgnoreTables.include? table
puts "Its true"
next
  else
ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
  end
 
end
   end
 end

Despite that some point table will be equal to students and students
is in the IgnoreTables array, it should skip to the next iteration,
but rather the else is triggered and the table is truncated.

Anyway know how to address this? Is there a method part of connection
that will help me achieve what I am trying to do?

Thanks for response

-- 
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: Duplicate Record Detection

2011-07-11 Thread Justin Stanczak
That would help slow the duplication, but if someone fills out a form and
submits fname, lname, ss#, and they typo the ss# I would have a duplicate. I
would like to display to admin users that this record has a related link, or
is similar. Similar to how Google finds duplicates in your contacts and
merges them.

On Mon, Jul 11, 2011 at 12:25 PM, pepe  wrote:

> validate_uniqueness_of might be of help?
>
> On Jul 10, 6:21 pm, Justin Stanczak  wrote:
> > How are others doing duplicate record detection? I'm not finding very
> many
> > solutions, or methods online. I found one called SimString, but not much
> > else. I was wondering how others are detecting duplicates. Similar to
> > suggested items, I would like to show records that may match or have
> similar
> > attributes.
>
> --
> 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] Re: Duplicate Record Detection

2011-07-11 Thread pepe
validate_uniqueness_of might be of help?

On Jul 10, 6:21 pm, Justin Stanczak  wrote:
> How are others doing duplicate record detection? I'm not finding very many
> solutions, or methods online. I found one called SimString, but not much
> else. I was wondering how others are detecting duplicates. Similar to
> suggested items, I would like to show records that may match or have similar
> attributes.

-- 
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] has_many and belongs_to association

2011-07-11 Thread Colin Law
On 11 July 2011 17:05, Yennie  wrote:
> Hi ,
>
> I want to test the one below but I got the problem
>
>  belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
>
> in my test
> context "test"do
>   should have_many :phrases
> end
>
> in language.rb
>  belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
>
> error is
>
>
>  1) Failure:
> test: check has_many and belongs_to  association should have many
> languages. (PhraseTest) [/usr/local/lib/ruby/gems/1.9.1/gems/
> shoulda-2.11.3/lib/shoulda/context.rb:324]:
> Expected Phrase to have a has_many association called languages
> (Language does not have a phrase_id foreign key.).
> Expected block to return true value.
>
>
> I dont really understand what it's warning now..

It might help us if you showed us the failing test.  Also I think it
would be better to use name_id as the foreign key for language
belongs_to :name.

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] has_many and belongs_to association

2011-07-11 Thread Yennie
Hi ,

I want to test the one below but I got the problem

 belongs_to :name, :class_name => "Phrase", :foreign_key => "name"

in my test
context "test"do
   should have_many :phrases
end

in language.rb
  belongs_to :name, :class_name => "Phrase", :foreign_key => "name"

error is


  1) Failure:
test: check has_many and belongs_to  association should have many
languages. (PhraseTest) [/usr/local/lib/ruby/gems/1.9.1/gems/
shoulda-2.11.3/lib/shoulda/context.rb:324]:
Expected Phrase to have a has_many association called languages
(Language does not have a phrase_id foreign key.).
Expected block to return true value.


I dont really understand what it's warning now..


Yennie

-- 
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] error of testing has_many :through

2011-07-11 Thread joanne ta
On Fri, Jul 8, 2011 at 4:28 PM, Colin Law  wrote:

> On 8 July 2011 21:19, Yennie  wrote:
> > Hi everyone,
> >
> > I am testing the validation of association of the model but i can a
> > error.. plzz help
> >
> >
> > error
> > /usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/
> > active_record/matchers/association_matcher.rb:27:in `have_many': wrong
> > number of arguments (2 for 1) (ArgumentError)
> >from
> /usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/
> > context.rb:429:in `method_missing'
> >from test/unit/prescription_test.rb:71:in `block in
> > '
> >from
> /usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/
> > context.rb:306:in `call'
> >from
> /usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/
> > context.rb:306:in `merge_block'
> >from
> /usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/
> > context.rb:301:in `initialize'
> >from
> /usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/
> > context.rb:199:in `new'
> >from
> /usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/
> > context.rb:199:in `context'
> >from test/unit/prescription_test.rb:64:in
> `'
> >from test/unit/prescription_test.rb:3:in `'
> >from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/
> > active_support/dependencies.rb:235:in `load'
> >from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/
> > active_support/dependencies.rb:235:in `block in load'
> >from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/
> > active_support/dependencies.rb:227:in `load_dependency'
> >from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/
> > active_support/dependencies.rb:235:in `load'
> >from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in
> `block
> > in '
> >from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in
> `each'
> >from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in
> `'
> > Loaded suite /usr/local/lib/ruby/1.9.1/rake/rake_test_loader
> > Started
> >
> >
> >
> > there is one
> >
> > prescription model
> >  has _many :others
> >  has_many :phrases, :through => :reasons
>
> You also need has_many :reasons in order to specify has_many through
> (I think).  Or should this be through :others?
>
> >
> > phrase model
> >  has_many :others
> >
> > reason model
> >  validates_presence_of :phrase_id, :message => "ERROR_MISSING_PHRASE"
> >  belongs_to :phrase
>
> Again you will need belongs_to prescription.
>
> >
> > other model
> >  validates_presence_of :phrase_id, :message => "ERROR_MISSING_PHRASE"
> >  belongs_to :phrase
>
> and belongs_to prescription.
>
> >
> > test file of prescription_test.rb
> > context "checking assocciation" do
> >  should have_many :phrases, :through => :others
>
> Above you have specified through reasons not through others.  Either
> the test or the relation is wrong.
>
> I follow the way that you said and edit "belongs to prescription"
right now it gives an error
/usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/active_record/matchers/association_matcher.rb:27:in
`have_many': wrong number of arguments (2 for 1) (ArgumentError)
from
/usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:429:in
`method_missing'
from test/unit/prescription_test.rb:71:in `block in
'
from
/usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:306:in
`call'
from
/usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:306:in
`merge_block'
from
/usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:301:in
`initialize'
from
/usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:199:in
`new'
from
/usr/local/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3/lib/shoulda/context.rb:199:in
`context'
from test/unit/prescription_test.rb:64:in `'
from test/unit/prescription_test.rb:3:in `'
from
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in
`load'
from
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in
`block in load'
from
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:227:in
`load_dependency'
from
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:235:in
`load'
from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in `block in
'
from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in `each'
from /usr/local/lib/ruby/1.9.1/rake/rake_test_loader.rb:5:in `'
Loaded suite /usr/local/lib/ruby/1.9.1/rake/rake_test_loader
Started


plz help

> 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

[Rails] Can't get this Rspec test to pass

2011-07-11 Thread clem_c_rock

Hello,
  I'm completely new to Rspec testing and I'm finding it very difficult to
mock specific objects.

In this test, I have a before block setup as such:

[code]
  before do
setup_controller_for_warden
controller.session[:operation_id] = 1
@operator = Factory :operator
sign_in :operator, @operator

@persist_herd = Herd.new
@persist_herd.operation_id = 1;
@persist_herd.herd_name = 'Persisted Herd
(herd_rations_controller_spec)'
@persist_herd.save!
  end

  describe "GET new" do
it "assigns a new herd_ration as @herd_ration" do
  HerdRation.stub(:new){ mock_herd_ration }
  Herd.stub(:find).with(1) { @persistant_herd }
  
  get :new, :herd_id => 1
  assigns(:herd_ration).should be(mock_herd_ration)
  response.should be_success
end
  end


and here's my controller method:

  def new
@herd_ration = HerdRation.new
@herd = Herd.find(params[:herd_id])

if @herd
  respond_with(@herd_rations, :layout=> !request.xhr?)
else
  redirect_to(root_url, :notice => 'No herd selected for ration.')
end
  end
[/code]

Here's the catch - we have this groovy little plugin that globally enforces
a model scope via a session id, in this case: session[:operation_id].

Here's the code for the plugin:

[code]
module ApplicationScopeManager


   mattr_accessor :global_scope
   @@global_scope = []

   mattr_accessor :local_scope
   @@local_scope = {}

   def self.included(base)
  base.send :extend, ClassMethods
   end

   def self.setup
  yield self
   end

   module ClassMethods


  def method_missing(name, *args, &block)

 return acts_as_scope_manager($1, args) if name.to_s =~
/^acts_as_scope_manager_for_(.*)/
 
 return honors_scope_of($1, args) if name.to_s =~
/^honors_scope_of_(.*)/
 
 return current_scope_for($1) if name.to_s =~
/^current_scope_for_(.*)/
 
 super
  end

  def current_scope_for(scope)
 Thread.current[scope.to_sym]
  end

  def acts_as_scope_manager(scope, *args)
 options = args[0].extract_options! if args
 send :include, InstanceMethods

 set_global_scope(scope,options[:with_global_scope]) if
options[:with_global_scope]

 send :before_filter, "set_scope_for_#{scope}".to_sym if
self.ancestors.include? ActionController::Base
 send :default_scope, where(scope.to_sym =>
send("current_scope_for_#{scope}".to_sym)[:finder_scope]).create_with(scope.to_sym
=>
 send("current_scope_for_#{scope}".to_sym)[:creator_scope]) if
(self.ancestors.include? ActiveRecord::Base) && Thread.current[scope.to_sym]
  end

  alias honors_scope_of acts_as_scope_manager

  private


  def set_global_scope(scope, *args)
 Thread.current[scope.to_sym] = {:global_scope => args}
  end

   end

   module InstanceMethods

  def method_missing(name, *args, &block)

 return set_scope_for($1, args) if name.to_s =~
/^set_scope_for_(.*)/

 super
  end

  private

  def set_scope_for(scope, *args)
 if session[scope].class == Array
application_scope = {:finder_scope => session[scope],
:creator_scope => nil }
 else
application_scope = {:finder_scope => [session[scope]],
:creator_scope => session[scope] }
 end

 application_scope[:finder_scope] = application_scope[:finder_scope]
+ Thread.current[scope.to_sym][:global_scope] if
Thread.current[scope.to_sym][:global_scope]

 Thread.current[scope.to_sym] = application_scope

  end

   end
end

[/code]

This plugin enforces any model that calls the honors_scope_of_operation_id
to include a lookup of the session[:operation_id] in all database calls.  
For instance if I do a Model.find(params[:id])  it will automatically add a
WHERE "field_name"."operation_id" = to the where clause.The problem I'm
having is that I can't seem to mock the session[:operation_id] in my Rspec
tests.I thought setting it this way  controller.session[:operation_id] =
1 in the before block would have been sufficient.

Any ideas?
-- 
View this message in context: 
http://old.nabble.com/Can%27t-get-this-Rspec-test-to-pass-tp32037786p32037786.html
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

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

2011-07-11 Thread Gaspard Bucher
Hi there !

If you want to test Zena between to rounds of beach volley, wave jumping,
ice climbing or whatever you do when not sitting in front of a screen, I
fixed many annoying bugs in the 1.0 release and created a brick to ease
deployment on shared hosting. There is even a small manual to deploy on
dreamhost:

http://bit.ly/oqoZ5i

Have fun

   Gaspard

--
Zena is a CMS based on Rails that lets you rapidly create complex
applications (without ever restarting the server). The main features are:

* data modeling (virtual classes, properties, indexing, relations)
* multilingual, versioned, publication workflow
* access control lists (different/limited access for a client for example)
* secured access to every element based on groups (like unix does)
* image handling, full page caching, pdf generation, csv, etc.

-- 
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] Pre-populating association

2011-07-11 Thread Christopher Thielen
Hello,

I think this is an easy one for the average Rails developer but I'm a bit stuck.

I'm creating a simple voting app: any user can create a survey, with any number 
of questions, and other users can then vote by creating a ballot for that 
survey.

Here's the modeling:

class Survey < ActiveRecord::Base
  has_many :questions
  has_many :eligibilities
  has_many :ballots

  accepts_nested_attributes_for :questions, :allow_destroy => true
  
  attr_accessible :title, :description, :status, :deadline, 
:questions_attributes
  
  def owner
Person.find(owner_id)
  end
end

class Question < ActiveRecord::Base
  belongs_to :survey
  has_many :preferences
end

class Ballot < ActiveRecord::Base
  belongs_to :survey
  has_many :preferences
end

class Preference < ActiveRecord::Base
  belongs_to :ballot
  belongs_to :question
end

To be clear: a survey is the set of questions and a ballot is a voter's set of 
answers (preferences).

I'm using the nested route: /surveys/[:survey_id]/ballot/new for the voting 
page.

What I'm having trouble with is pre-populating the ballot with empty 
preferences. When ballot/new is called, I do this:

def new
@survey = Survey.find(params[:survey_id])

@ballot = @survey.ballots.build

# Prepare the ballot
for question in @ballot.survey.questions
  p = Preference.new
  p.ballot = @ballot
  p.question = question
  @ballot.preferences << p
end

respond_to do |format|
  format.html # new.html.erb
  format.xml  { render :xml => @ballot }
end
  end

and on the ballot/new.html.erb page, I try this:

<%= form_for [@survey, @ballot] do |f| %>
  <%= f.fields_for :preferences do |preference_form| %>
<%= preference_form.fields_for :question do |question_form| %>
  
<%= question_form.label :question %>
<%= radio_button("preference", "preference", "Yes") %> Yes
<%= radio_button("preference", "preference", "No") %> No
<%= radio_button("preference", "preference", "Decline") %> Decline
  
<% end %>
  <% end %>

  
<%= f.submit "Vote" %>
  
<% end %>

But this merely shows one set of radio buttons with no question text, though 
I've confirmed the @survey.questions are populated with questions.

Does anybody see what I'm doing wrong here? My guess is looking at the 
new.html.erb is going to really show off something incorrect.

Christopher Thielen

-- 
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 freelancers in Delhi?

2011-07-11 Thread coolno9
Hi all,

I am looking for up to two Rails free-lancers in Delhi. Hacker should
be comfortable with the bleeding edge of rails. The project-period
will be approximately 8 weeks long, and will be paid for at the end of
the project-period.

For more details write in to >> robertandy 1980 at gmail dot com along
with your latest resume.

Cheers,
- Robert

-- 
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] [JOB] Medidata Solutions is looking for Ruby on Rails Developers for our Uxbridge, UK office

2011-07-11 Thread MarkS
WHERE TECHNOLOGY MEETS MEDICINE

Join a fast-growing leader in delivering innovative technologies to
help life sciences organizations bring life-enhancing and life-saving
medical treatments to those who need them – safely and quickly.

You are:
• curious and not afraid to get your hands dirty
• fanatical about quality
• savvy about databases of all kinds, including MySql, NoSql, and
Graph databases
• passionate about performance and user experience
• jazzed when considering space and time characteristics of data
structures and algorithms

You want to:
• work with Unix, RoR, Javascript, Chef, Cucumber, RSpec
• build simple, intuitive applications
• design small, isolated, highly-available, fault-tolerant, scalable
services
• work in an agile team
• write tests before you write code
• constantly question, research, simplify, learn, improve
• be inspired by your work and your colleagues

We are:
Medidata Solutions, a global company, with R&D centers in New York
City (Union Square), London, Tokyo, and San Francisco. Our R&D team is
comprised of Medidata employees only – we outsource nothing related to
product development. We are continually questioning, researching,
learning, simplifying, and improving our platform, which is used by
over 200 life sciences companies and manages clinical trial data for
over two-million patients.

We value:
Our people. The Medidata spirit is entrepreneurial, innovative,
nimble, and collaborative.  We value people who know their worth and
want to work where they are recognized and compensated accordingly. We
value people who want to work for an industry leader known for
redefining the way new drugs are brought to market through successful
clinical trials.

Medidata Solutions, Inc. is an Equal Opportunity Employer. Medidata
Solutions provides equal employment opportunities to all employees and
applicants for employment without regard to race, color, religion,
gender, sexual orientation, national origin, age, disability, or
status as a veteran. Medidata Solutions complies with applicable state
and local laws governing non-discrimination in employment in every
location in which the company has facilities.

Contact us at:
careers at mdsol.com
or check out our open jobs at:
http://mdsol.com/about/careers.htm

-- 
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] [Job] Medidata Solutions is looking for Ruby on Rails Developers for our New York City office

2011-07-11 Thread MarkS
WHERE TECHNOLOGY MEETS MEDICINE

Join a fast-growing leader in delivering innovative technologies to
help life sciences organizations bring life-enhancing and life-saving
medical treatments to those who need them – safely and quickly.

You are:
• curious and not afraid to get your hands dirty
• fanatical about quality
• savvy about databases of all kinds, including MySql, NoSql, and
Graph databases
• passionate about performance and user experience
• jazzed when considering space and time characteristics of data
structures and algorithms

You want to:
• work with Unix, RoR, Javascript, Chef, Cucumber, RSpec
• build simple, intuitive applications
• design small, isolated, highly-available, fault-tolerant, scalable
services
• work in an agile team
• write tests before you write code
• constantly question, research, simplify, learn, improve
• be inspired by your work and your colleagues

We are:
Medidata Solutions, a global company, with R&D centers in New York
City (Union Square), London, Tokyo, and San Francisco. Our R&D team is
comprised of Medidata employees only – we outsource nothing related to
product development. We are continually questioning, researching,
learning, simplifying, and improving our platform, which is used by
over 200 life sciences companies and manages clinical trial data for
over two-million patients.

We value:
Our people. The Medidata spirit is entrepreneurial, innovative,
nimble, and collaborative.  We value people who know their worth and
want to work where they are recognized and compensated accordingly. We
value people who want to work for an industry leader known for
redefining the way new drugs are brought to market through successful
clinical trials.

Medidata Solutions, Inc. is an Equal Opportunity Employer. Medidata
Solutions provides equal employment opportunities to all employees and
applicants for employment without regard to race, color, religion,
gender, sexual orientation, national origin, age, disability, or
status as a veteran. Medidata Solutions complies with applicable state
and local laws governing non-discrimination in employment in every
location in which the company has facilities.

Contact us at:
careers at mdsol.com
or check out our open jobs at:
http://mdsol.com/about/careers.htm

-- 
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 INSTALLATION TUTORIALS

2011-07-11 Thread Manuele Dones
Since a lot of users are still asking how they can easily install rails, 
here is my tutorials. Feel free to add yours!

RAILS 3 + SQLITE3 for 
Ubuntu
RAILS 3 + MYSQL for 
Ubuntu

RAILS 3 + SQLITE3 for 
Fedora

RAILS 3 + SQLITE3/MYSQL for 
Windows

-- 
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/-/erZqC4i5mcoJ.
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] rails installation problem

2011-07-11 Thread sanmugasundaram k
On Mon, Jul 11, 2011 at 11:46 AM, Sayuj Othayoth wrote:

>
> use *sudo gem install rails -v=3.0.9*
>
it says,
[dhastha@Dhastha:~] $ sudo gem install rails -v=3.0.9
[sudo] password for dhastha:
WARNING:  RubyGems 1.2+ index not found for:


RubyGems will revert to legacy indexes degrading performance.
Updating metadata for 1 gems from http://rubygems.org/
.
complete
Updating metadata for 1 gems from http://rubygems.org/
.
complete
ERROR:  Could not find a valid gem 'rails' (= 3.0.9) in any repository
[dhastha@Dhastha:~] $


>
> On Mon, Jul 11, 2011 at 9:19 AM, sanmugasundaram k 
> wrote:
>
>>
>> hi,
>>
>>i am new for rails. i installed rails like
>>
>> $sudo gem install rails
>>
>> it installed rails 3.0.9. while i am trying to create rails project like
>>
>> $rails new sample -d mysql
>>
>> it says rails currently not installed try to install 'sudo apt-get install
>> rails' (i am using ubuntu10.10)
>>
>> then i installed rails like,
>>
>> $sudo apt-get install rails - it installed. Then i create my project it
>> only create rails 2.3.5 project not rails 3.0.9 project.
>>
>> then i checked rails version like
>>
>> $ rails -v - it replied "Rails 2.3.5"
>>
>> but in gem list rails 3.0.9 only installed.
>>
>> why, i unable to create rails 3.0.9 project.
>>
>> thank you..
>>
>> --
>>  நன்றி ...
>>
>> சண்முகசுந்தரம்.க
>>
>>   Kanchi Linux User Group
>>
>>  http://kanchilug.wordpress.com
>>
>>  My Experiments In Linux are here
>>
>>  http://gowithfoss.wordpress.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.
>



-- 
 நன்றி ...

சண்முகசுந்தரம்.க

  Kanchi Linux User Group

 http://kanchilug.wordpress.com

 My Experiments In Linux are here

 http://gowithfoss.wordpress.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] rails installation problem

2011-07-11 Thread sanmugasundaram k
On Mon, Jul 11, 2011 at 11:45 AM, Dheeraj Kumar
wrote:

> No point using ruby via apt-get. You need to install RVM, and ruby.
>
> An easy way is to use RailsReady - a one step ruby installation script.
>
>
> http://thechangelog.com/post/2857400260/railsready-setup-script-to-get-ruby-and-rails-running
>
> PS: Kanchi has a LUG? thats news to me :) I'm from Chennai myself :)
>
yes,kanchilug is one of the linux user group like indian linux user group
chennai(ilugc).we contribute open source via our LUG. Our LUG activities
here http://kanchilug.wordpress.com.

>
> On Mon, Jul 11, 2011 at 9:19 AM, sanmugasundaram k 
> wrote:
>
>>
>> hi,
>>
>>i am new for rails. i installed rails like
>>
>> $sudo gem install rails
>>
>> it installed rails 3.0.9. while i am trying to create rails project like
>>
>> $rails new sample -d mysql
>>
>> it says rails currently not installed try to install 'sudo apt-get install
>> rails' (i am using ubuntu10.10)
>>
>> then i installed rails like,
>>
>> $sudo apt-get install rails - it installed. Then i create my project it
>> only create rails 2.3.5 project not rails 3.0.9 project.
>>
>> then i checked rails version like
>>
>> $ rails -v - it replied "Rails 2.3.5"
>>
>> but in gem list rails 3.0.9 only installed.
>>
>> why, i unable to create rails 3.0.9 project.
>>
>> thank you..
>>
>> --
>>  நன்றி ...
>>
>> சண்முகசுந்தரம்.க
>>
>>   Kanchi Linux User Group
>>
>>  http://kanchilug.wordpress.com
>>
>>  My Experiments In Linux are here
>>
>>  http://gowithfoss.wordpress.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.
>



-- 
 நன்றி ...

சண்முகசுந்தரம்.க

  Kanchi Linux User Group

 http://kanchilug.wordpress.com

 My Experiments In Linux are here

 http://gowithfoss.wordpress.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] Help with Helpers

2011-07-11 Thread Colin Law
On 11 July 2011 08:36, Rodrigo Ruiz  wrote:
> I'd like to know where exactly are helpers available by default?
> For example, if I have a PagesController, will my PagesHelper methods be
> available at PagesController? or just at the Pages's views?

In addition to other replies note that logic in controllers should
rarely be sufficiently complex so as to require helpers.  Such code
should almost always be in the models.

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 installation problem

2011-07-11 Thread gezope
Hi,

follow the steps from my Github repo 
https://github.com/gezope/InstallingRailsOnUbuntu
and get me back if you still have problems. Important: if you're usig
RVM (you definitely should) then don't use 'sudo' for install. First I
think just use SQLite3.

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/38f8b7747aa08778
http://www.web2linux.com/05/installing-rails-3-on-ubuntu-10-04-lucid-lynx/
http://rubyhyderabad.blogspot.com/

Good lick
Zoli

On Jul 11, 5:49 am, sanmugasundaram k  wrote:
> hi,
>
>        i am new for rails. i installed rails like
>
> $sudo gem install rails
>
> it installed rails 3.0.9. while i am trying to create rails project like
>
> $rails new sample -d mysql
>
> it says rails currently not installed try to install 'sudo apt-get install
> rails' (i am using ubuntu10.10)
>
> then i installed rails like,
>
> $sudo apt-get install rails - it installed. Then i create my project it only
> create rails 2.3.5 project not rails 3.0.9 project.
>
> then i checked rails version like
>
> $ rails -v - it replied "Rails 2.3.5"
>
> but in gem list rails 3.0.9 only installed.
>
> why, i unable to create rails 3.0.9 project.
>
> thank you..
>
> --
>  நன்றி ...
>
> சண்முகசுந்தரம்.க
>
>   Kanchi Linux User Group
>
>  http://kanchilug.wordpress.com
>
>  My Experiments In Linux are here
>
>  http://gowithfoss.wordpress.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: How to Install ruby 1.9.2/1.9.1 and Rails 3.x on Ubuntu

2011-07-11 Thread gezope
Hi,

check Github repo https://github.com/gezope/InstallingRailsOnUbuntu
about installing RVM with Ruby1.9 and Rails3. Follow the step and
write me if you have any problem. Bests,
Zoli

On Jul 11, 7:32 am, Emeka  wrote:
> Hello All,
>
> I have   Ubuntu 11-04, I would want to install ruby 1.9.2/1.9.1 and Rails
> 3.x. I need the least complicated way of doing this.
>
> Rgds,
> Janus
>
> --
> *Satajanus  Nig. Ltd
>
> *

-- 
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: Help with Helpers

2011-07-11 Thread paul h


On Jul 11, 8:58 am, Dheeraj Kumar  wrote:
> Helpers help generate code for the view. For example, if you have an array
> of items that need to be rendered in a specific way, you can encapsulate
> that functionality in a helper method, and call it from the view. It helps
> clean up the view code, and adds code reuse. So helpers are meant to be for
> views, not controllers.
>
> On Mon, Jul 11, 2011 at 1:06 PM, Rodrigo Ruiz wrote:
>
>
>
> > I'd like to know where exactly are helpers available by default?
>
> > For example, if I have a PagesController, will my PagesHelper methods be
> > available at PagesController? or just at the Pages's views?

Dheeraj is correct, helpers are intended for views, but if you have a
method that you need access to in your controller and your view, and/
or your helper then, in order to keep things a little DRYer, you can
define your method in your controller, and make it available to the
view and helper as so:

class MyController < ApplicationController

  helper_method :my_method

  private

def my_method
  # do something
end

end

Now you can access my_method from your view or your helper as well as
your controller.

hth

Paul
>
> > Thank you,
> > Rodrigo
>
> > --
> > 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.- Hide quoted text -
>
> - Show quoted text -

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

2011-07-11 Thread Dheeraj Kumar
Helpers help generate code for the view. For example, if you have an array
of items that need to be rendered in a specific way, you can encapsulate
that functionality in a helper method, and call it from the view. It helps
clean up the view code, and adds code reuse. So helpers are meant to be for
views, not controllers.

On Mon, Jul 11, 2011 at 1:06 PM, Rodrigo Ruiz wrote:

> I'd like to know where exactly are helpers available by default?
>
> For example, if I have a PagesController, will my PagesHelper methods be
> available at PagesController? or just at the Pages's views?
>
> Thank you,
> Rodrigo
>
> --
> 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] Help with Helpers

2011-07-11 Thread Rodrigo Ruiz
I'd like to know where exactly are helpers available by default?

For example, if I have a PagesController, will my PagesHelper methods be
available at PagesController? or just at the Pages's views?

Thank you,
Rodrigo

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