Ruby on Rails Thursday, February 28, 2013

You can use this gem:

https://github.com/damncabbage/carrierwave-sftp

hope this will help you..

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Ruby guides is really great resource for RoR learning. But I can advise you www.codeschool.com also. They have fun course called "Rails for Zombies". It's little messy for the begginers, but it really helps me when I was just started RoR learning.

пятница, 22 февраля 2013 г., 9:25:53 UTC+4 пользователь JohnA написал:

 What are some Great resources to get into Rails?
 Keep in mind this is for someone that has little to no programming experience.
So starting from scratch...

A little background is that I want to create a program for personal use that uses Databases to store lots of information. They wopuld draw from each other and work to help in large scale event planning and management.

Any help is appreciated. Thank you!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/0_muAf9e2iEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I am RoR begginer too. And I've started with terminal and sublime text2. This way helps me to understand RoR internals, common commands and other. But in future I'm planing to use RubyMine, because it can improve development speed.

четверг, 28 февраля 2013 г., 7:50:20 UTC+4 пользователь Stewart Alsop написал:

Should I use an IDE for beginning with Rails?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/PLfgFXcZXNEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

You can add sublime packages for almost anything including code completion.  

On Feb 28, 2013, at 11:00 PM, Michael Archibald <micharch54@gmail.com> wrote:

I've used :
  • Sublime Text 2 - Wonderful editor, still my favorite. Fast, light and great customization.  By default it won't complete your code which is great while learning a language.
  • Rubymine - We use this at work.  It's nice, bit sluggish but it has great code completion and with keybindings you can jump to method definitions really easily.  Great if you want to see what's going on in Rails internals.
  • vim - I am not a power vim user, but if you get to that level this is probably the best editor.  I've never seen more productive developers than those that use this thing.  It's awesome.
  • Geany (linux) - Great little editor that will have a lot of functionality of sublime out of the box if you need something on the cheap.
  • TextWrangler(mac) - Fast and light.  Not nearly as many features as sublime text but wonderful still the same.
  • Aptana - This was alright, slow and not my favorite.
I've used others but those are the ones I can remember.  Honestly the top two are my favorites.  
  •  


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/9dcppms1SyEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I've used :
  • Sublime Text 2 - Wonderful editor, still my favorite. Fast, light and great customization.  By default it won't complete your code which is great while learning a language.
  • Rubymine - We use this at work.  It's nice, bit sluggish but it has great code completion and with keybindings you can jump to method definitions really easily.  Great if you want to see what's going on in Rails internals.
  • vim - I am not a power vim user, but if you get to that level this is probably the best editor.  I've never seen more productive developers than those that use this thing.  It's awesome.
  • Geany (linux) - Great little editor that will have a lot of functionality of sublime out of the box if you need something on the cheap.
  • TextWrangler(mac) - Fast and light.  Not nearly as many features as sublime text but wonderful still the same.
  • Aptana - This was alright, slow and not my favorite.
I've used others but those are the ones I can remember.  Honestly the top two are my favorites.  
  •  

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/9dcppms1SyEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

> That .git folder is access to your heroku app.

thanks! I have cleaned it all now.

soichi

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

That .git folder is access to your heroku app.

On Thu, Feb 28, 2013 at 9:29 PM, Soichi Ishida <lists@ruby-forum.com> wrote:
>> I hope you removed the most obvious things like config/database.yml and
>> .git o.O
>
> Is it OK to remove .git folder entirely ? Surely, the person to whom I
> will give this away will user git afterwards.
>
> soichi
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

> I hope you removed the most obvious things like config/database.yml and
> .git o.O

Is it OK to remove .git folder entirely ? Surely, the person to whom I
will give this away will user git afterwards.

soichi

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

A1. If you have a mockup already you replicate most of the look and feel by pasting that in your erb file and replacing forms etc with their form helper counterparts.  The only issue to keep in mind, most of those produce less than optimal code, which means you may want to clean that up a bit.  

A2. Rails comes with jQuery included by default (in later versions anyways). You can simply bind events to the DOM with jQuery.  Something along the lines of:
$('#someId).on('click',function(){
     yourfunction();
});
It's really quite easy once you learn how.  http://api.jquery.com/category/events/

On Thursday, February 28, 2013 5:32:04 PM UTC-7, Ruby-Forum.com User wrote:
Q1. It looks that most convenient way of developing Rails Views is using
form helpers when developing forms and partials.

On the other hand one can develop much richer HTML5 pages/mockups using
WYSIWYG tools like CKEditor, Dojo/IBM Maqetta, etc.

How one can continue with Rails having already developed Web site
mockups?

Q2. Up to my findings, Ajax can be automatically fired using
:remote=>true but just in link_to and form_for helpers.

There are many other JavaScript client events when one needs Ajax to be
called. How to proceed with Ajax in that case, for example onClick
mouse/keyboard event?

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Evjj4-Brd88J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On Thu, Feb 28, 2013 at 9:21 PM, Soichi Ishida <lists@ruby-forum.com> wrote:
> All the functionalities should remain so, but I need to erase important
> information prior to the action.
>
> For example, the app was using heroku server, and I am wondering if
> there is any information specifying the server authentication within the
> rails project.
> I have already facebook app ID and secret.

I hope you removed the most obvious things like config/database.yml and .git o.O

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Rails 3.2.11

I have decided to give away (not online! but physically) the source code
of my project to someone.
All the functionalities should remain so, but I need to erase important
information prior to the action.

For example, the app was using heroku server, and I am wondering if
there is any information specifying the server authentication within the
rails project.
I have already facebook app ID and secret.

What do you think?

soichi

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Thu, Feb 28, 2013 at 4:33 AM, Colin Law <clanlaw@googlemail.com> wrote:
> On 28 February 2013 10:28, Pardeep Dhingra <lists@ruby-forum.com> wrote:
>> Hey,
>>
>> According to me you should not use any IDE. Instead if you are ubuntu
>> you can use gedit with its plugins for autocomplete and indentation
>> etc...
>
> I like jEdit for the editor, with its excellent project viewer plugin
> and code parsing with sidekick.
>
> Colin

Emacs, baby, all the way! :)

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

You're welcome. In these two pages you can see everithing about rails

Matt's


On Thu, Feb 28, 2013 at 9:46 PM, Lucas de Almeida Marciano <lucas.almeida.marciano@gmail.com> wrote:
Muito bom o material!

Em quinta-feira, 28 de fevereiro de 2013 16h50min59s UTC-3, Lucas de Almeida Marciano escreveu:
Bom dia, pessoal vocês poderiam me indicar um local onde posso estudar como posso configurar os models, fazendo relação de muitos para muitos, de um para um etc?

Muito obrigado!

Ruby Power!!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/zLdCk7GkID0J.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Boa noite pessola, estou fazendo o meu trabalho de conclusão de curso e estou querendo saber o seguinte:

Há alguma maneira de eu atribuir, no atributo usuario, por exemplo, o usuário que esteja conectado (current_user) no momento da criação de um objeto qualquer que tenha dependencia com o usuario?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/vanx0nTFXh0J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Muito bom o material!

Em quinta-feira, 28 de fevereiro de 2013 16h50min59s UTC-3, Lucas de Almeida Marciano escreveu:

Bom dia, pessoal vocês poderiam me indicar um local onde posso estudar como posso configurar os models, fazendo relação de muitos para muitos, de um para um etc?

Muito obrigado!

Ruby Power!!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/zLdCk7GkID0J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Q1. It looks that most convenient way of developing Rails Views is using
form helpers when developing forms and partials.

On the other hand one can develop much richer HTML5 pages/mockups using
WYSIWYG tools like CKEditor, Dojo/IBM Maqetta, etc.

How one can continue with Rails having already developed Web site
mockups?

Q2. Up to my findings, Ajax can be automatically fired using
:remote=>true but just in link_to and form_for helpers.

There are many other JavaScript client events when one needs Ajax to be
called. How to proceed with Ajax in that case, for example onClick
mouse/keyboard event?

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails


Matt's


On Thu, Feb 28, 2013 at 4:50 PM, Lucas de Almeida Marciano <lucas.almeida.marciano@gmail.com> wrote:
Bom dia, pessoal vocês poderiam me indicar um local onde posso estudar como posso configurar os models, fazendo relação de muitos para muitos, de um para um etc?

Muito obrigado!

Ruby Power!!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/70_cnFyLHWAJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On 28 February 2013 17:49, Dmitrij B. <lists@ruby-forum.com> wrote:
> sorry. When i add in normal terminal command line: rails new
> nameproject... All ok, creates a new project. But in Terminator if i
> want create new project, message - The program 'rails' can be found in
> the following packages:
> * rails
> * ruby-railties-3.2
>
> Yes, i install on ubuntu rails.

You still have not answered the questions I asked, and again you did
not quote the previous message so no-one knows what you are saying
sorry about. The questions were
1. Have you tried re-booting?
2. How did you install rails (not on what OS, but how did you install rails)
3. What is the result of the command
which rails

Once again please quote this message. Insert your replies after each
of the questions above, then you will not forget any.

Colin

>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Im not too sure about this but try loading ur profile in terminal first.
I remember i used to have to always had to run

. .bashrc


For my terminal color scheme to take effect in Terminator but then did something with my bash_login to make it permanent when opened Terminator. 

Im not sure of what command you have to type but its google stuff about making sure your user setting from the default terminal are also brought over to Terminator.

Stuff with bash_profile bash_login bash_logout ect.. ect..

Hope this helps.

Tron.

On Thursday, February 28, 2013 9:49:41 AM UTC-8, Ruby-Forum.com User wrote:

sorry. When i add in normal terminal command line: rails new
nameproject... All ok, creates a new project. But in Terminator if i
want create new project, message - The program 'rails' can be found in
the following packages:
 * rails
 * ruby-railties-3.2

Yes, i install on ubuntu rails.

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/dFIUrnWlhH0J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi


I have created a polymorphic association for comments since I need commenting functionality on several models. The issue is that when I create the comment in my Commets#create action, I really don't know what type the parent is of.

So, let's say I have Foo, Bar and Comment. Comment have this:
  belongs_to :commentable, polymorphic: true

And Foo and Bar both have:
  has_many :comments, as: :commentable

In my routes.rb I nest the comments:
  resources :foo do
    resources :comments
  end

  resources :bar do
    resources :comments
  end

A new comment is posted to /foo/1/comments or /bar/1/comments. When I'm in the Comments#create action, how am I supposed to create the comment through either Foo/Bar?

If it is a comment for a Foo resource, I need to do:
@commentable = Foo.find(params[:foo_id])
@commentable.comments.create(....)

But if it's Bar I need to do:
@commentable = Bar.find(params[:bar_id])
@commentable.comments.create(....)

What I do now is to use this method:
 def find_commentable
  params.each do |name, value|
    if name =~ /(.+)_id$/
      return $1.classify.constantize.find(value)
    end
  end
  nil
 end

and

@commentable = find_commentable

Which loops over all params for something that ends with _id and then get the class name from that etc... But that feels a bit "hackish" to me :S Another solution would be to add the "commentable_id" and "commentable_type" as hidden fields in my Comment form.


How do you handle this issue? Are there better ways than the way above?

Cheers

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/V8lO_B42uQsJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Bom dia, pessoal vocês poderiam me indicar um local onde posso estudar como posso configurar os models, fazendo relação de muitos para muitos, de um para um etc?

Muito obrigado!

Ruby Power!!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/70_cnFyLHWAJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

sorry. When i add in normal terminal command line: rails new
nameproject... All ok, creates a new project. But in Terminator if i
want create new project, message - The program 'rails' can be found in
the following packages:
* rails
* ruby-railties-3.2

Yes, i install on ubuntu rails.

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

source ~/.bash_profile

On Fri, Mar 1, 2013 at 1:01 AM, Colin Law <clanlaw@googlemail.com> wrote:
On 28 February 2013 16:47, Dmitrij B. <lists@ruby-forum.com> wrote:
> in normal terminal show Rails 3.2.11

Is that supposed to be a reply to my question?  If so go and read the
question again more carefully and make sure you reply to all the
questions asked (there were three questions).  For none of the
questions was 3.2.11 a valid reply ( I did not ask which rails you are
using, but what is the result of the command "which rails").  Also
when replying include the previous post so that we know what you are
replying to.  Remember this is a mailing list not a forum (though you
may be accessing it through a forum like interface).  Thanks

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
 greatghoul - Ask and Learn!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On 28 February 2013 16:47, Dmitrij B. <lists@ruby-forum.com> wrote:
> in normal terminal show Rails 3.2.11

Is that supposed to be a reply to my question? If so go and read the
question again more carefully and make sure you reply to all the
questions asked (there were three questions). For none of the
questions was 3.2.11 a valid reply ( I did not ask which rails you are
using, but what is the result of the command "which rails"). Also
when replying include the previous post so that we know what you are
replying to. Remember this is a mailing list not a forum (though you
may be accessing it through a forum like interface). Thanks

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

in normal terminal show Rails 3.2.11

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

So you can modified that given method with no of persons...

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hey all!

Are you coming to Portland, OR for RailsConf 2013? If so, you should join us for a hike on Sunday, April 28th, 2013.

The Planet Argon team is going to take care of everything: transportation, snacks, waters, and maybe even a few surprise goodies—all totally free!

For more information, check out:


Hope to see you there!

Cheers,
Robby

-- 
Robby Russell
Chief Evangelist, Partner

PLANET ARGON, LLC
Web Design and Development with Ruby on Rails

http://planetargon.com/

+1 503 847 9214
+1 815 642 4068 [fax]

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/fHmzEKs9gQQJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On 26 February 2013 11:47, Sajeev Zacharias <sajeev.zacharias4@gmail.com> wrote:
> I have 3 models,
>
> class Host
> ref: string
> address: string,
> name: string
> primary_key='ref'
> has_many :rooms, :class_name=>"Room", :foreign_key=>'host_ref'
>
> Class Room
> ref :string
> host_ref: string
> capacity: integer
> primary_key='ref'
> has_many :bookings, :class_name=>"Booking",
> :foreign_key=>'room_ref'
> belongs_to :host

You will need a foreign_key spec on the above.

>
> Class Booking
> ref: string
> room_ref :string
> start_date: date
> end_date: string

Why is end_date a string?

> number_of_guests :integer
> primary_key='ref'
> belongs_to :room

You will need a foreign_key spec here also.


Unless you are connecting to a legacy database that you /definitely/
cannot change then do not use unusual names for the keys, and do not
use string types. With Rails your life will be much simpler if you
stick to the Rails conventions.

>
> Here one should be able to see the vacancies against each host.
> A person when he enters the start date, end date and number of persons to
> book for a room, he must get the list of hosts who have rooms vacant and
> number of vacancies. How can I write the query in rails?

If you cannot see how to write the complete query then, for a start,
just do what you can in the query and do the rest in code. Make sure
that your automated tests check out the results and the tests pass.
Then, if necessary, you can refactor the code and queries to make it
more efficient, secure in the knowledge that your tests will show that
it is correct. If you cannot even see how to make a start then the
first thing is to write the requirement in pseudo code (something like
find hosts where ..and ..). Once you can write that down clearly and
unambiguously then you should be well on the way towards the solution.

Colin

>
> for example:
>
> Suppose the records are
> Host
> ref name address
> host#1 Mr Allan 23, Camden Street
> host#2 Mr Tom 12, nassau Street
> host#3 Mr anice 34, Philip street
>
> Room
> ref host_ref capacity
> room#1 host#1 3
> room#2 host#2 1
> room#3 host#2 4
> room#4 host#3 2
> room#5 host#3 1
> room#6 host#3 2
> room#7 host#3 3
>
> Booking
> ref room_ref start_date end_date no_of_guests
> b#1 room#1 10-02-2013 20-02-2013 2
> b#2 room#2 05-02-2013 15-02-2013 1
> b#3 room#1 01-02-2013 13-02-2013 1
> b#4 room#3 15-02-2013 28-02-2013 1
> b#5 room#5 10-03-2013 15-03-2013 1
> b#6 room#7 15-02-2013 25-02-2013 1
>
>
> I want to search for the number of vacancies against each host.
> suppose I want to search as
>
> start date: 15-02-2013 end date:18-02-2013 number of persons:2
>
> I must get the result as:
>
> host#2 Mr Tom 12, nassau Street
> room#3 1 booked 3 free 4 total
>
> host#3 Mr anice 34, Philip street
> room#4 0 booked 2 free 2 total
> room#6 0 booked 2 free 2 total
> room#7 1 booked 2 free 3 total
>
> Example 2: If I want to search as
>
> start date: 01-02-2013 end date 13-02-2013 no of persons:1
>
> I must get the result as
>
> host#1 Mr Allan 23, Camden Street
> room#1 2 booked 1 free 3 total
>
> host#2 Mr Tom 12, nassau Street
> room#2 0 booked 1 free 1 total
>
> host#3
> room#4 0 booked 2 free 2 total
> room#5 0 booked 1 free 1 total
> room#6 0 booked 2 free 2 total
> room#7 1 booked 2 free 3 total
> How can I achieve this result in rails? Can I get the query for this or
> loop?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/YMbxBYzIiKsJ.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 28 February 2013 13:37, vasanth k. <lists@ruby-forum.com> wrote:
> I create the project in scaffold but I cant able to edit it and update
> th values

I guess you are a beginner in Rails. If so then I suggest that you
work right through a good tutorial such as railstutorial.org, which is
free to use online. That will show you the basics of Rails.

Once you have done that, if you still get the problem, and still
cannot work it out then have a look at the Rails Guide on Debugging,
which will show you techniques that can be used to debug your code.

If you have to post messages in future then please paste them in as
text rather than an image. It is easier to follow the thread if
everything is in the message.

Colin

>
> I gort the error in no action required I attach the image bellow
> and my codeing the controller is :
>
> @department = Department.find(params[:id])
>
> respond_to do |format|
> if @department.update_attributes(params[:departments])
> flash[:notice] = 'Department was successfully updated.'
> format.html { redirect_to(@department) }
> format.xml { head :ok }
> else
> format.html { render :action => "edit" }
> format.xml { render :xml => @department.errors, :status =>
> :unprocessable_entity }
> end
> end
>
> Attachments:
> http://www.ruby-forum.com/attachment/8184/edit.jpg
>
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 28 February 2013 12:04, Dmitrij B. <lists@ruby-forum.com> wrote:
> I install on ubuntu terminal terminator. I want create new project and
> show error: The program 'rails' can be found in the following packages:
> * rails
> * ruby-railties-3.2
>
> In empty terminal no problem.

Have you tried re-booting?
How have you installed rails?
If, in the normal terminal, you type
which rails
what does it show?

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Pardeep Dhingra wrote in post #1099533:
> Hey,
> Test this code.
> Call
>
> Host.available(start_date,end_date)
>
> hope it will help you.

But we search with number of persons.

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails



On Tuesday, 26 February 2013 14:35:23 UTC-5, xop wrote:

When using "attributes=" for an object with a accepts_nested_attributes_for a model
that has a has_many relationship will cause the has_many array to be appended-to
instead of being replaced as would be expected by a straight assignment operation.

See this example:

class Member < ActiveRecord::Base
  has_many :posts
  accepts_nested_attributes_for :posts
end

class Post < ActiveRecord::Base
  belongs_to :member
end

m=Member.new
p={:name => 'joe', :posts_attributes => [{:title=>'t1'},{:title=>'t2'}]}

m.attributes = p
m.posts.size ----> 2

m.attributes = p
m.posts.size ----> 4

Is this a feature or a bug?  If it is a feature, how is it supposed to be used?

With nested attributes, you'll wind up creating new records unless the entries in :posts_attributes have an :id key which indicates they're existing records to be updated.

--Matt Jones 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/KT4-djio61EJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi all,

Any help would be much appreciated. Please see question posted on SO:
http://stackoverflow.com/questions/15137336/devise-authentication-not-working-in-test-environment-with-rspec-request-spec-an

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/llm0uvJaJNYJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I create the project in scaffold but I cant able to edit it and update
th values

I gort the error in no action required I attach the image bellow
and my codeing the controller is :

@department = Department.find(params[:id])

respond_to do |format|
if @department.update_attributes(params[:departments])
flash[:notice] = 'Department was successfully updated.'
format.html { redirect_to(@department) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @department.errors, :status =>
:unprocessable_entity }
end
end

Attachments:
http://www.ruby-forum.com/attachment/8184/edit.jpg


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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Feb 28, 2013, at 12:32 AM, William Pramana wrote:

> Hi,
>
> I just read the tutorial on autocomplete search terms - http://railscasts.com/episodes/399-autocomplete-search-terms.
>
> My question is, how do I enable linking to the search result so people can click and go to the item permanent link.
>

Where would that link appear? Is that in the search results, or elsewhere? As far as I know, the autocomplete search technique is used to populate a text field in a form. That form is then submitted, and what happens then is up to your controller and views.

Walter

> Thanks,
>
> William
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/nWQn6O2AEj8J.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hey,
Test this code.
Call

Host.available(start_date,end_date)

hope it will help you.

Attachments:
http://www.ruby-forum.com/attachment/8183/testcode.tar.gz


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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I install on ubuntu terminal terminator. I want create new project and
show error: The program 'rails' can be found in the following packages:
* rails
* ruby-railties-3.2

In empty terminal no problem.

How solve this problem?

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Worth trying! But unfortunately not working neither. But thanks!

Op 28 feb 2013, om 12:10 heeft Pardeep Dhingra het volgende geschreven:

> I think you need
>
> get ':controller/help'
> and
>
> get ':namespace/:controller/help'
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/XSEIpeRHC68/unsubscribe?hl=en-US.
> To unsubscribe from this group and all its topics, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I think you need

get ':controller/help'
and

get ':namespace/:controller/help'

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 28 February 2013 10:28, Pardeep Dhingra <lists@ruby-forum.com> wrote:
> Hey,
>
> According to me you should not use any IDE. Instead if you are ubuntu
> you can use gedit with its plugins for autocomplete and indentation
> etc...

I like jEdit for the editor, with its excellent project viewer plugin
and code parsing with sidekick.

Colin

>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I get the same error, I solved with the 32bit version, ruby+devkit

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hey,

According to me you should not use any IDE. Instead if you are ubuntu
you can use gedit with its plugins for autocomplete and indentation
etc...

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

http://guides.rubyonrails.org/action_controller_overview.html#filters Here you'll get a clear description about how to use Filters.

--
Best Regards,
Ryan Cheung


On Thu, Feb 28, 2013 at 11:00 AM, 卓一抗 <zhuoyikang@gmail.com> wrote:
hello, everybody.
in ror, we can add a after_filter to a controller.

 def aes_encrypt
    response.body = AesHelper.aes_encrypt(response.body)
  end

 after_filter :aes_encrypt   

and all action's repsonse int the controller can be encrypt.

and my question is , how to decrypt data use before_filter, or anything else.

ex: i want to post json data to /usr/register,   the json data is {"name":"good", "password":"nice"}. encrypt it to 
5B2YC7WzgFmaivnATP1ZLR4sTXB3SsWEUeMpUbcYiylcvHxfSStYIBqwIMCjZAY3

so i post 5B2YC7WzgFmaivnATP1ZLR4sTXB3SsWEUeMpUbcYiylcvHxfSStYIBqwIMCjZAY3  to /usr/register

in action register , i would write code like this:
#### already decrypt.
def register
   User.register(params[:name], params[:passport])
end

so, how can i decrypt 5B2YC7WzgFmaivnATP1ZLR4sTXB3SsWEUeMpUbcYiylcvHxfSStYIBqwIMCjZAY3 before action register to use params directly in register

thanks for anybody's help!!



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/JA4STvbtDMUJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

There's no need to use an IDE to code with Rails. Text Editor such as VIM or Sublime Text 2 would be enough!

--
Best Regards,
Ryan Cheung


On Thu, Feb 28, 2013 at 11:50 AM, Stewart Alsop <stewartalsopiii@gmail.com> wrote:
Should I use an IDE for beginning with Rails?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/rWDRY84jLFUJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On 28 February 2013 03:50, Stewart Alsop <stewartalsopiii@gmail.com> wrote:
> Should I use an IDE for beginning with Rails?

In my opinion, no. Others may disagree. At least start with no IDE
in order to understand the underlying commands. Once you have the
basics then you can try IDEs to see if they offer you any advantages.

My standard advice to beginners is to work right through a good
tutorial such as railstutorial.org, which is free to use online. Also
I recommend using Linux (eg Ubuntu) or Mac for development.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails Wednesday, February 27, 2013

Hi,

I just read the tutorial on autocomplete search terms - http://railscasts.com/episodes/399-autocomplete-search-terms. 

My question is, how do I enable linking to the search result so people can click and go to the item permanent link. 

Thanks,

William

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/nWQn6O2AEj8J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Should I use an IDE for beginning with Rails?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/rWDRY84jLFUJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hey all,

I'm trying to create a task that prepare the environment to start programming.
To do so, I created a task like this task :setup_env => ['db:reset', 'db:migrate', 'db:test:prepare'] and observed that after execute rake setup_env, it never execute db:test:prepare properly. In order to get the schema cloned to test db, I have to execute rake db:test:prepare manually after rake setup_env
I also noticed that if I also write the task like task :setup_env => ['db:reset', 'db:test:prepare'] or task :setup_env => ['db:migrate', 'db:test:prepare'] it still skips db:test:prepare.
Instead of using task dependency, I also tried executing Rake::Task['db:test:prepare'] and it doesn't execute as well.

Does anyone have an idea?
Thanks.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/tzBwEfv4HLEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

hello, everybody.

in ror, we can add a after_filter to a controller.

 def aes_encrypt
    response.body = AesHelper.aes_encrypt(response.body)
  end

 after_filter :aes_encrypt   

and all action's repsonse int the controller can be encrypt.

and my question is , how to decrypt data use before_filter, or anything else.

ex: i want to post json data to /usr/register,   the json data is {"name":"good", "password":"nice"}. encrypt it to 
5B2YC7WzgFmaivnATP1ZLR4sTXB3SsWEUeMpUbcYiylcvHxfSStYIBqwIMCjZAY3

so i post 5B2YC7WzgFmaivnATP1ZLR4sTXB3SsWEUeMpUbcYiylcvHxfSStYIBqwIMCjZAY3  to /usr/register

in action register , i would write code like this:
#### already decrypt.
def register
   User.register(params[:name], params[:passport])
end

so, how can i decrypt 5B2YC7WzgFmaivnATP1ZLR4sTXB3SsWEUeMpUbcYiylcvHxfSStYIBqwIMCjZAY3 before action register to use params directly in register

thanks for anybody's help!!



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/JA4STvbtDMUJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

That worked perfectly. Thanks alot for the help, and ill keep the line
#'s in mind for next time

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 27 February 2013 19:56, Colton Pl <lists@ruby-forum.com> wrote:
> TicketType(#70316537311800) expected, got String(#10085740)
>
> app/controllers/reasons_controller.rb:44:in `new'
> app/controllers/reasons_controller.rb:44:in `create'
>
> View:
>
> <%= f.label :ticket_type %><br />
> <%= f.select :ticket_type, TicketType.all.collect {|t| [ t.description,
> t.description]}, {:include_blank => "Please select one"}, :method =>
> 'get'%>
>
> Controller:
>
> @reason = Reason.new(params[:reason])
>
> respond_to do |format|
> if @reason.save
> format.html { redirect_to manage_tickets_path, notice: 'Reason
> was successfully created.' }
> etc
>
> Model:
>
> class Reason < ActiveRecord::Base
> validates :description, :ticket_type, :presence => true
> attr_accessible :description, :ticket_type
>
> belongs_to :ticket_type, :foreign_key => :ticket_type

If you have the foreign key column called ticket_type and also
belongs_to ticket_type, then when you do @reason.ticket_type how is
rails going to know whether you want the value of the column or the
associated object? Best to stick to the conventions and call the
column ticket_type_id.

By the way, when posting an error it is a good idea to tell us which
line is the line the error refers to (ie which is line 44 in this
case) in order to save us having to work it out ourselves.

Colin

> end
>
> class TicketType < ActiveRecord::Base
> attr_accessible :description
>
> has_many :reasons, :foreign_key => :ticket_type
> end
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 27 February 2013 16:40, C Wilson <cwilson05@gmail.com> wrote:
> I am new to Rails

Have you worked right through a good Rails tutorial such as
railstutorial.org in order to understand the basics of Rails? If not
then do that first.

If you have already done that then have a look at the Rails Guide on
debugging which will show you techniques that you can use to debug
your code and work out what is going wrong. The first thing you must
do is understand why it is doing what it is doing, then you can work
out how to fix it.

Colin


> and I am setting up the user profile and adding fields to
> it for users to add details to their profile such as career, about me,
> height, religion, etc. This information is completely different from the
> registration options (account settings). As of now the profile fields are
> being recognized as the registration fields, which is incorrect. When I
> click "Update" on profile page, it redirects to registration page. So the
> profile page with all those fields have no value atm. The system is not
> recogonizing that those values should be saved to the user profile. How it
> should work is when user goes to their page at /users/4 it will present
> forms for all their profile details. After selecting answers for each
> options, the user clicks the button "Update" and the profile information
> saves. The complete opposite is happening as of now, user clicks "Update"
> and it directs User back to the index (which is the register page) and it
> acts as if the previous page the User was on (profile page) was trying to
> fill out information from the registration form...which is incorrect.
>
> Users_controller file (can also find all this information on
> https://gist.github.com/pwz2k/5047974) :
>
>>> class UsersController < ApplicationController
>>>
>>> def new
>>>
>>> @user = User.new
>>>
>>> end
>>>
>>>
>>>
>>> def create
>>>
>>> @user = User.new(params[:user])
>>>
>>> if @user.save
>>>
>>> UserMailer.registration_confirmation(@user).deliver
>>>
>>> session[:user_id] = @user.id
>>>
>>> redirect_to root_url, notice: "Thank you for signing up!"
>>>
>>> else
>>>
>>> render "new"
>>>
>>> end
>>>
>>> end
>>>
>>>
>>>
>>> def show
>>>
>>> @user = User.find(params[:id])
>>>
>>> end
>>>
>>>
>>>
>>> def edit
>>>
>>> @user = User.find(params[:id])
>>>
>>> end
>>>
>>>
>>>
>>> def index
>>>
>>> @users = User.all
>>>
>>> end
>>>
>>>
>>>
>>> def destroy
>>>
>>> User.find(params[:id]).destroy
>>>
>>> flash[:success] = "User deleted."
>>>
>>> redirect_to users_url
>>>
>>> end
>>>
>>>
>>>
>>> def update
>>>
>>> @user = User.find(params[:id])
>>>
>>> if @user.update_attributes(params[:user])
>>>
>>> flash[:success] = "Account updated"
>>>
>>> redirect_to @user
>>>
>>> else
>>>
>>> render 'edit'
>>>
>>> end
>>>
>>> end
>>>
>>> end
>
>
>
>
> show.html file:
>
> <h1><%= @user.username %></h1>
>
> <h2>Basics</h2>
>
> <%= form_for(@user, :url => {:action => :create}) do |f| %>
> <div class="field">
> <%= f.label :height %><br/>
> <%= f.select :about_me, [['Feet', nil], '4', '5', '6'] %>
> <%= f.select :about_me, [['Inches', nil], '0', '1', '2', '3', '4',
> '5', '6', '7', '8', '9', '10', '11'] %>
> </div>
> <div class="field">
> <%= f.label :children %><br/>
> <%= f.select :children, [['Do you have or want kids?', nil], 'Yes, they live
> with me', 'I want kids now', 'I want one someday', 'Not for me']%>
> </div>
> <div class="field">
> <%= f.label :religion %><br/>
> <%= f.select :religion, [['What is your faith?', nil], 'Agnostic',
> 'Atheist', 'Christian', 'Catholic', 'Buddhist', 'Hindu', 'Jewish', 'Muslim',
> 'Spiritual without affiliation', 'Other', 'None', 'Prefer not to say'
> ]%><br/>
> <%= f.select :religion, [['How important is this to you?', nil], 'Very
> Important', 'Somewhat Important', 'Not Important']%>
> </div>
> <div class="field">
> <%= f.label :career %><br/>
> <%= f.text_field :career %>
> </div>
> <div class="field">
> <%= f.label :education %><br/>
> <%= f.select :education, [['What is your education level?', nil], 'High
> school', 'Some college', 'Undergraduate', "Bachelor's", "Master's ", 'PhD',
> 'Business school', 'Law school', 'Medical school' ]%>
> </div>
> <div class="field">
> <%= f.label :ethnicity %><br/>
> <%= f.select :ethnicity, [['What is your ethnicity?', nil], 'Asian',
> 'Black', 'Biracial', 'Indian', 'Hispanic/Latin', 'Middle Eastern', 'Native
> American', 'Pacific Islander', 'White', 'Other' ]%>
> </div>
> <%= f.label :user_drink %><br/>
> <%= f.select :user_drink, [['How much do you drink?', nil], 'Often Drinks',
> 'Sometimes drinks', 'Never drinks', 'No comment' ]%>
> </div><br/>
> <%= f.label :user_smoke %><br/>
> <%= f.select :user_smoke, [['How often do you smoke?', nil], 'Often smokes',
> 'Sometimes smokes', 'Never smokes'] %>
> </div>
> <div class="actions"><%= f.submit %></div>
> <h3>About Me</h3>
> <%= form_for @user do |f| %>
> <div class="field">
> <%= f.label :about_me %><br/>
> <%= f.text_field :about_me %>
> <div class="actions"><%= f.submit %></div>
>
> <% end %>
> <% end %>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/HPIn5dTfxI8J.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hey everyone! I am pumped to announce that Rails 3.2.13.rc1 has been released!
If no regressions are found I will release 3.2.13 final in two weeks, on March
13, 2013. If you find one, please [Open an Issue on
GitHub](https://github.com/rails/rails/issues/new) so that I can fix it before
the final release.

This is a bugfix release, with 287 commits. There is one big thing that is
technically a fix but is sort of a feature: Ruby 2.0 support. Big thanks to
Prem Sichanugrist for putting that together! Please give your applications a
try on Ruby 2.0 and let me know how that goes.

## CHANGES since 3.2.12

*Action Mailer*

No changes.

*Action Pack*

* Determine the controller#action from only the matched path when using the
shorthand syntax. Previously the complete path was used, which led
to problems with nesting (scopes and namespaces).
Fixes #7554.
Backport #9361.

Example:

# this will route to questions#new
scope ':locale' do
get 'questions/new'
end

*Yves Senn*

* Fix `assert_template` with `render :stream => true`.
Fix #1743.
Backport #5288.

*Sergey Nartimov*

* Eagerly populate the http method loookup cache so local project
inflections do
not interfere with use of underscore method ( and we don't need locks )

*Aditya Sanghi*

* `BestStandardsSupport` no longer duplicates `X-UA-Compatible` values on
each request to prevent header size from blowing up.

*Edward Anderson*

* Fixed JSON params parsing regression for non-object JSON content.

*Dylan Smith*

* Prevent unnecessary asset compilation when using `javascript_include_tag` on
files with non-standard extensions.

*Noah Silas*

* Fixes issue where duplicate assets can be required with sprockets.

*Jeremy Jackson*

* Bump `rack` dependency to 1.4.3, eliminate `Rack::File` headers
deprecation warning.

*Sam Ruby + Carlos Antonio da Silva*

* Do not append second slash to `root_url` when using `trailing_slash: true`

Fix #8700.
Backport #8701.

Example:
# before
root_url # => http://test.host//

# after
root_url # => http://test.host/

*Yves Senn*

* Fix a bug in `content_tag_for` that prevents it for work without a block.

*Jasl*

* Clear url helper methods when routes are reloaded by removing the methods
explicitly rather than just clearing the module because it didn't work
properly and could be the source of a memory leak.

*Andrew White*

* Fix a bug in `ActionDispatch::Request#raw_post` that caused
`env['rack.input']`
to be read but not rewound.

*Matt Venables*

* More descriptive error messages when calling `render :partial` with
an invalid `:layout` argument.

Fixes #8376.

render :partial => 'partial', :layout => true
# results in ActionView::MissingTemplate: Missing partial /true

*Yves Senn*

* Accept symbols as `#send_data` :disposition value. [Backport
#8329] *Elia Schito*

* Add i18n scope to `distance_of_time_in_words`. [Backport #7997]
*Steve Klabnik*

* Fix side effect of `url_for` changing the `:controller` string
option. [Backport #6003]
Before:

controller = '/projects'
url_for :controller => controller, :action => 'status'

puts controller #=> 'projects'

After

puts controller #=> '/projects'

*Nikita Beloglazov + Andrew White*

* Introduce `ActionView::Template::Handlers::ERB.escape_whitelist`.
This is a list
of mime types where template text is not html escaped by default.
It prevents `Jack & Joe`
from rendering as `Jack &amp; Joe` for the whitelisted mime types.
The default whitelist
contains text/plain. Fix #7976 [Backport #8235]

*Joost Baaij*

* `BestStandardsSupport` middleware now appends it's
`X-UA-Compatible` value to app's
returned value if any. Fix #8086 [Backport #8093]

*Nikita Afanasenko*

* prevent double slashes in engine urls when
`Rails.application.default_url_options[:trailing_slash] = true` is set
Fix #7842

*Yves Senn*

* Fix input name when `:multiple => true` and `:index` are set.

Before:

check_box("post", "comment_ids", { :multiple => true, :index
=> "foo" }, 1)
#=> <input name=\"post[foo][comment_ids]\" type=\"hidden\"
value=\"0\" /><input id=\"post_foo_comment_ids_1\"
name=\"post[foo][comment_ids]\" type=\"checkbox\" value=\"1\" />

After:

check_box("post", "comment_ids", { :multiple => true, :index
=> "foo" }, 1)
#=> <input name=\"post[foo][comment_ids][]\" type=\"hidden\"
value=\"0\" /><input id=\"post_foo_comment_ids_1\"
name=\"post[foo][comment_ids][]\" type=\"checkbox\" value=\"1\" />

Fix #8108

*Daniel Fox, Grant Hutchins & Trace Wax*

*Active Model*

* Specify type of singular association during serialization *Steve Klabnik*

*Active Record*

* Reverted 921a296a3390192a71abeec6d9a035cc6d1865c8, 'Quote numeric values
compared to string columns.' This caused several regressions.

*Steve Klabnik*

* Fix overriding of attributes by default_scope on `ActiveRecord::Base#dup`.

*Hiroshige UMINO*

* Fix issue with overriding Active Record reader methods with a
composed object
and using that attribute as the scope of a `uniqueness_of` validation.
Backport #7072.

*Peter Brown*

* Sqlite now preserves custom primary keys when copying or altering tables.
Fixes #9367.
Backport #2312.

*Sean Scally + Yves Senn*

* Preloading `has_many :through` associations with conditions won't
cache the `:through` association. This will prevent invalid
subsets to be cached.
Fixes #8423.
Backport #9252.

Example:

class User
has_many :posts
has_many :recent_comments, -> { where('created_at > ?',
1.week.ago) }, :through => :posts
end

a_user = User.includes(:recent_comments).first

# this is preloaded
a_user.recent_comments

# fetching the recent_comments through the posts association
won't preload it.
a_user.posts

*Yves Senn*

* Fix handling of dirty time zone aware attributes

Previously, when `time_zone_aware_attributes` were enabled, after
changing a datetime or timestamp attribute and then changing it back
to the original value, `changed_attributes` still tracked the
attribute as changed. This caused `[attribute]_changed?` and
`changed?` methods to return true incorrectly.

Example:

in_time_zone 'Paris' do
order = Order.new
original_time = Time.local(2012, 10, 10)
order.shipped_at = original_time
order.save
order.changed? # => false

# changing value
order.shipped_at = Time.local(2013, 1, 1)
order.changed? # => true

# reverting to original value
order.shipped_at = original_time
order.changed? # => false, used to return true
end

Backport of #9073
Fixes #8898

*Lilibeth De La Cruz*

* Fix counter cache columns not updated when replacing `has_many :through`
associations.
Backport #8400.
Fix #7630.

*Matthew Robertson*

* Don't update `column_defaults` when calling destructive methods on
column with default value.
Backport c517602.
Fix #6115.

*Piotr Sarnacki + Aleksey Magusev + Alan Daud*

* When `#count` is used in conjunction with `#uniq` we perform
`count(:distinct => true)`.
Fix #6865.

Example:

relation.uniq.count # => SELECT COUNT(DISTINCT *)

*Yves Senn + Kaspar Schiess*

* Fix `ActiveRecord::Relation#pluck` when columns or tables are
reserved words.
Backport #7536.
Fix #8968.

*Ian Lesperance + Yves Senn + Kaspar Schiess*

* Don't run explain on slow queries for database adapters that don't
support it.
Backport #6197.

*Blake Smith*

* Revert round usec when comparing timestamp attributes in the dirty tracking.
Fixes #8460.

*Andrew White*

* Revert creation of through association models when using `collection=[]`
on a `has_many :through` association from an unsaved model.
Fix #7661, #8269.

*Ernie Miller*

* Fix undefined method `to_i` when calling `new` on a scope that uses an
Array; Fix FloatDomainError when setting integer column to NaN.
Fixes #8718, #8734, #8757.

*Jason Stirk + Tristan Harward*

* Serialized attributes can be serialized in integer columns.
Fix #8575.

*Rafael Mendonça França*

* Keep index names when using `alter_table` with sqlite3.
Fix #3489.
Backport #8522.

*Yves Senn*

* Recognize migrations placed in directories containing numbers and 'rb'.
Fix #8492.
Backport of #8500.

*Yves Senn*

* Add `ActiveRecord::Base.cache_timestamp_format` class attribute to control
the format of the timestamp value in the cache key.
This allows users to improve the precision of the cache key.
Fixes #8195.

*Rafael Mendonça França*

* Add `:nsec` date format. This can be used to improve the precision
of cache key.
Please note that this format only works with Ruby 1.9, Ruby 1.8
will ignore it completely.

*Jamie Gaskins*

* Unscope `update_column(s)` query to ignore default scope.

When applying `default_scope` to a class with a where clause, using
`update_column(s)` could generate a query that would not properly update
the record due to the where clause from the `default_scope` being applied
to the update query.

class User < ActiveRecord::Base
default_scope where(active: true)
end

user = User.first
user.active = false
user.save!

user.update_column(:active, true) # => false

In this situation we want to skip the default_scope clause and just
update the record based on the primary key. With this change:

user.update_column(:active, true) # => true

Backport of #8436 fix.

*Carlos Antonio da Silva*

* Fix performance problem with primary_key method in PostgreSQL
adapter when having many schemas.
Uses pg_constraint table instead of pg_depend table which has many
records in general.
Fix #8414

*kennyj*

* Do not instantiate intermediate Active Record objects when eager loading.
These records caused `after_find` to run more than expected.
Fix #3313
Backport of #8403

*Yves Senn*

* Fix `pluck` to work with joins. Backport of #4942.

*Carlos Antonio da Silva*

* Fix a problem with `translate_exception` method in a non English
environment.
Backport of #6397.

*kennyj*

* Fix dirty attribute checks for TimeZoneConversion with nil and blank
datetime attributes. Setting a nil datetime to a blank string should not
result in a change being flagged.
Fixes #8310.
Backport of #8311.

*Alisdair McDiarmid*

* Prevent mass assignment to the type column of polymorphic
associations when using `build`.
Fixes #8265.
Backport of #8291.

*Yves Senn*

* When running migrations on Postgresql, the `:limit` option for
`binary` and `text` columns is
silently dropped.
Previously, these migrations caused sql exceptions, because
Postgresql doesn't support limits
on these types.

*Victor Costan*

* `#pluck` can be used on a relation with `select` clause.
Fixes #7551.
Backport of #8176.

Example:

Topic.select([:approved, :id]).order(:id).pluck(:id)

*Yves Senn*

* Use `nil?` instead of `blank?` to check whether dynamic finder with a bang
should raise RecordNotFound.
Fixes #7238.

*Nikita Afanasenko*

* Fix deleting from a HABTM join table upon destroying an object of a model
with optimistic locking enabled.
Fixes #5332.

*Nick Rogers*

* Use query cache/uncache when using ENV["DATABASE_URL"].
Fixes #6951.
Backport of #8074.

*kennyj*

* Do not create useless database transaction when building `has_one`
association.

Example:

User.has_one :profile
User.new.build_profile

Backport of #8154.

*Bogdan Gusiev*

* `AR::Base#attributes_before_type_cast` now returns unserialized
values for serialized attributes.

*Nikita Afanasenko*

* Fix issue that raises `NameError` when overriding the
`accepts_nested_attributes` in child classes.

Before:

class Shared::Person < ActiveRecord::Base
has_one :address

accepts_nested_attributes :address, :reject_if => :all_blank
end

class Person < Shared::Person
accepts_nested_attributes :address
end

Person
#=> NameError: method `address_attributes=' not defined in Person

After:

Person
#=> Person(id: integer, ...)

Fixes #8131.

*Gabriel Sobrinho, Ricardo Henrique*

*Active Resource*

No changes.

*Active Support*

* Fix DateTime comparison with DateTime::Infinity object.

*Dan Kubb*

* Remove surrogate unicode character encoding from ActiveSupport::JSON.encode
The encoding scheme was broken for unicode characters outside the basic
multilingual plane; since json is assumed to be UTF-8, and we
already force the
encoding to UTF-8 simply pass through the un-encoded characters.

*Brett Carter*

* Fix mocha v0.13.0 compatibility. *James Mead*

* `#as_json` isolates options when encoding a hash. [Backport #8185]
Fix #8182

*Yves Senn*

* Handle the possible Permission Denied errors atomic.rb might trigger due to
its chown and chmod calls. [Backport #8027]

*Daniele Sluijters*

*Railties*

No changes.

*Full listing*

To see the full list of changes, [check out all the commits on
GitHub](https://github.com/rails/rails/compare/v3.2.12...v3.2.13.rc1).

## SHA-1

If you'd like to verify that your gem is the same as the one I've uploaded,
please use these SHA-1 hashes:

* `6a33c2d10abb5512499addb675df658e179f2e79` actionmailer-3.2.13.rc1.gem
* `11d8303470698c5b0ac68f187a15093c07383c89` actionpack-3.2.13.rc1.gem
* `a72dafd8b1e3372cc4dda9015b93bf5509b25baa` activemodel-3.2.13.rc1.gem
* `3c6463ab11658b5ab0fe6a4ad06eb52968ef4492` activerecord-3.2.13.rc1.gem
* `06cec200b95dc1f64614cd03432e9ab06742a865` activeresource-3.2.13.rc1.gem
* `5ff59cacae5295baf30a6fb8fb656037f22af3c2` activesupport-3.2.13.rc1.gem
* `facf4549445922d9dc2a836283ae928fa52df4f8` rails-3.2.13.rc1.gem
* `55e44f621efbf531d9ccade6d27259f7dabae167` railties-3.2.13.rc1.gem

<3<3<3

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.