Ruby on Rails Sunday, September 30, 2012

Quoting S Ahmed <sahmed1020@gmail.com>:
> I am trying this:
>
> I want to replace all the text in between java comments:
>
> /* start */
> replace this text here
> /* end */
>
>
> I'm trying:
>
> text.gsub(//* start */(.*)/* end *//im, replace_with)
>
> But i'm getting errors relating to expecting keyword_end.
>
> How should I be escaping /* and */ ?

Yes,
text.gsub(/\/\* start \*\/(.*)\/\* end \*\//im, replace_with)

Slightly simpler
text.gsub(%r{/\* start \*/(.*)/\* end \*/}im, replace_with)

>
> Also, does string interpolation work in gsub regex? Say I had variables
> like:
>
> start_tag = "/* start */"
> end_tag = "/* end */"
>
> I want to do:
>
> text.gsub("#{start_tag}(.*)#{end_tag}", replace_with)
>

gsub takes regex, not strings

text.gsub(/#{start_tag}(.*)#{end_tag}/, replace_with)

Special characters do need to be escaped in start_tag and end_tag, but in this
case only the asterisks, not the slashes.

HTH,
Jeffrey

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

Ruby on Rails

The question is kind of long and probably simple...I posted on
StackOverflow at the link below. Thank you in advance for anyone taking
the time to look.

http://stackoverflow.com/questions/12667093/creating-a-friend-while-on-their-profile-page

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

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

Ruby on Rails

The question is kind of long and probably simple...I posted on
StackOverflow at the link below. Thank you in advance for anyone taking
the time to look.

http://stackoverflow.com/questions/12667093/creating-a-friend-while-on-their-profile-page

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

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

Ruby on Rails

thanks!


BTW, is it possible that during the replace, it leaves the start/end tag? 
Currently it is replacing it also, I want the comments to be there after the replacement.


On Sun, Sep 30, 2012 at 7:49 PM, bricker <bricker88@gmail.com> wrote:
You have to escape the slashes and asterisk in the regex, as they are regular expression characters. http://rubular.com is a great place to learn and play around with regular expressions.

    text.gsub(/\/\* start \*\/(.*)\/\* end \*\//im, replace_with)

Yes, interpolation works in regular expressions:

    text.gsub(/#{start_tag}(.*)#{end_tag}/, replace_with)


On Sunday, September 30, 2012 4:17:03 PM UTC-7, Gitted wrote:
I am trying this:

I want to replace all the text in between java comments:

/* start */
replace this text here
/* end */


I'm trying:

text.gsub(//* start */(.*)/* end *//im, replace_with)

But i'm getting errors relating to expecting keyword_end.

How should I be escaping /* and */   ?

Also, does string interpolation work in gsub regex?  Say I had variables like:

start_tag = "/* start */"
end_tag = "/* end */"

I want to do:

text.gsub("#{start_tag}(.*)#{end_tag}", replace_with)

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/-4Zgher1s3UJ.
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 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

You have to escape the slashes and asterisk in the regex, as they are regular expression characters. http://rubular.com is a great place to learn and play around with regular expressions.


    text.gsub(/\/\* start \*\/(.*)\/\* end \*\//im, replace_with)

Yes, interpolation works in regular expressions:

    text.gsub(/#{start_tag}(.*)#{end_tag}/, replace_with)


On Sunday, September 30, 2012 4:17:03 PM UTC-7, Gitted wrote:
I am trying this:

I want to replace all the text in between java comments:

/* start */
replace this text here
/* end */


I'm trying:

text.gsub(//* start */(.*)/* end *//im, replace_with)

But i'm getting errors relating to expecting keyword_end.

How should I be escaping /* and */   ?

Also, does string interpolation work in gsub regex?  Say I had variables like:

start_tag = "/* start */"
end_tag = "/* end */"

I want to do:

text.gsub("#{start_tag}(.*)#{end_tag}", replace_with)

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

Ruby on Rails

I am trying this:


I want to replace all the text in between java comments:

/* start */
replace this text here
/* end */


I'm trying:

text.gsub(//* start */(.*)/* end *//im, replace_with)

But i'm getting errors relating to expecting keyword_end.

How should I be escaping /* and */   ?

Also, does string interpolation work in gsub regex?  Say I had variables like:

start_tag = "/* start */"
end_tag = "/* end */"

I want to do:

text.gsub("#{start_tag}(.*)#{end_tag}", replace_with)

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

Ruby on Rails

In my current project, there are business and security requirements that prevent certain values from being exposed. I was looking for a way to specify which attributes in a model should be protected. This is what I've come up with and I would love feedback as to whether or not it's a valid solution and how I could improve it.


Basically, I'm following the attr_accessible style and defining an attr_private method for setting specific attributes (or methods) as private.

http://codereview.stackexchange.com/questions/16064/protecting-certain-model-attributes-from-being-exposed-in-an-api

Your thoughts are much appreciated. Thanks in advance.

Jeremy

--
You received 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.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/SgLzY2BcotAJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Hi all,

I have two models, Item and Bid


class Item
  include Mongoid::Document
  field :name, type: String
  has_many :bids 
end
class Bid
  include Mongoid::Document
  include Mongoid::Timestamps::Created
  field :bid, type: Float
  belongs_to :item  
end

In views/prices/index I would like to list all items in a table and for each item put a field next it in which people can enter a number. At the bottom of the form should be a submit button for all records.

How is this best achieved?

There's plenty of code out there explaining how to add, for instance, several questions to one survey but I couldn't find an example that shows how to add one new record for each of of an existing element of a collection. 

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/adUQnc0M9R8J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I've setup my application to connect to multiple databases, but am running into a few issues in production.  I also have a few questions.

First, I'm using rails 3-2-stable, because I was running in to a prepared statement bug, which is only fixed in this branch [1].  I'm not up for using master at this time, unless I absolutely need to.

Second, the pool size for the default and non-default database is 1, this is because I'm using unicorn.  Also, because establish_connection on multiple databases does not use the pool size [2].

The issue:

I have 4 unicorn workers.  After I start the app and rapidly refresh on a few pages, the default database sees 4 connections.  The non-default database sees only 1.  And for the lifetime of the app, the non-default database only sees one connection. I also think this is slowing down the website.

1) What would cause the application to create only one connection for the non-default database, provided I have 4 workers?  When I create a sample app on my local machine that uses the same configs with different code, I actually get 4 connections for both.  See my unicorn file here:  https://gist.github.com/3807073.  All my non-default database models inherit from something that looks like:

class OtherDb < ActiveRecord::Base
  self.abstract_class = true
  establish_connection "other_#{Rails.env}"
end

2) What's the proper way to setup a unicorn.rb file for multiple databases with `preload_app true`, since I have establish_connection in the OtherDb model and need to establish_connection to the default in the after_fork?

3) Should I be looking into a different rack web server?  My queries are sub 500ms.

[1] https://github.com/rails/rails/pull/5872
[2] https://github.com/rails/rails/issues/7019

--
You received 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.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/xbXCsD-xXJ0J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

http://railscasts.com/episodes/88-dynamic-select-menus-revised

===================
Alexandre Mondaini Calvão

"Nossa recompensa se encontra no esforço e não no resultado. Um esforço total é uma vitória completa." [Ghandi]


2012/9/30 Colin Law <clanlaw@googlemail.com>
On 30 September 2012 13:34, BalaRaju Vankala <foreverbala4u@gmail.com> wrote:
> Hey Thank you for response... i am fresher can you describe little bit more
> or can you send any links..

Look for tutorials on javascript and after you have mastered those it
is probably a good idea to move to jQuery.  For using ajax then google
for rails ajax and you will find many examples.

As a beginner I suggest you work right through some good rails
tutorials such as railstutorial.org (which is free to use online).
This will introduce you to the basics or rails, including ajax.  Make
sure that any tutorial you use is for rails 3 and that you have the
correct version of rails installed.

Colin

>
> On Sun, Sep 30, 2012 at 5:57 PM, Colin Law <clanlaw@googlemail.com> wrote:
>>
>> On 30 September 2012 13:23, BalaRaju Vankala <foreverbala4u@gmail.com>
>> wrote:
>> > Hello Every one
>> >     I have a small doubt . How  On selecting the country, state dropdown
>> > gets refreshed . for Ex i selected india . i got all states of india in
>> > drop
>> > down list.
>>
>> You will have to use javascript to do this, or update the list using
>> an ajax call.
>>
>> 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+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
>
> --
> నేను
> కొంచం తపన,
>  కాస్త ఆసక్తి,
> కొన్ని కలలు,
>  కాసిన్ని ఊహలు కలిపేస్తే
>  నేను
>  bala raju
>
> --
> You received 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 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 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 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 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On 30 September 2012 13:34, BalaRaju Vankala <foreverbala4u@gmail.com> wrote:
> Hey Thank you for response... i am fresher can you describe little bit more
> or can you send any links..

Look for tutorials on javascript and after you have mastered those it
is probably a good idea to move to jQuery. For using ajax then google
for rails ajax and you will find many examples.

As a beginner I suggest you work right through some good rails
tutorials such as railstutorial.org (which is free to use online).
This will introduce you to the basics or rails, including ajax. Make
sure that any tutorial you use is for rails 3 and that you have the
correct version of rails installed.

Colin

>
> On Sun, Sep 30, 2012 at 5:57 PM, Colin Law <clanlaw@googlemail.com> wrote:
>>
>> On 30 September 2012 13:23, BalaRaju Vankala <foreverbala4u@gmail.com>
>> wrote:
>> > Hello Every one
>> > I have a small doubt . How On selecting the country, state dropdown
>> > gets refreshed . for Ex i selected india . i got all states of india in
>> > drop
>> > down list.
>>
>> You will have to use javascript to do this, or update the list using
>> an ajax call.
>>
>> 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+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
>
>
> --
> నేను
> కొంచం తపన,
> కాస్త ఆసక్తి,
> కొన్ని కలలు,
> కాసిన్ని ఊహలు కలిపేస్తే
> నేను
> bala raju
>
> --
> You received 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 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 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

Hey Thank you for response... i am fresher can you describe little bit more or can you send any links..

On Sun, Sep 30, 2012 at 5:57 PM, Colin Law <clanlaw@googlemail.com> wrote:
On 30 September 2012 13:23, BalaRaju Vankala <foreverbala4u@gmail.com> wrote:
> Hello Every one
>     I have a small doubt . How  On selecting the country, state dropdown
> gets refreshed . for Ex i selected india . i got all states of india in drop
> down list.

You will have to use javascript to do this, or update the list using
an ajax call.

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
నేను
కొంచం తపన,
 కాస్త ఆసక్తి,
కొన్ని కలలు,
 కాసిన్ని ఊహలు కలిపేస్తే
 నేను
 bala raju

--
You received 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On 30 September 2012 13:23, BalaRaju Vankala <foreverbala4u@gmail.com> wrote:
> Hello Every one
> I have a small doubt . How On selecting the country, state dropdown
> gets refreshed . for Ex i selected india . i got all states of india in drop
> down list.

You will have to use javascript to do this, or update the list using
an ajax call.

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Hello Every one

    I have a small doubt . How  On selecting the country, state dropdown gets refreshed . for Ex i selected india . i got all states of india in drop down list. 

--
You received 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

2012/9/30 Colin Law <clanlaw@googlemail.com>:

> Have you considered using Heroku? Then you will not have the problems
> of setting up, maintaining, and especially the securrity issues, of
> trying to run your own server.

I gave him this tip earlier, it seems that he refuses it. Probably
feared by the expenses?

--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

On 30 September 2012 09:42, Mandeep Kaur <meghasimak@gmail.com> wrote:
> On Sun, Sep 30, 2012 at 2:03 PM, Colin Law <clanlaw@googlemail.com> wrote:
> <snip>
>> Do you need the website to be accessible to the global internet or just locally?
>>
>
> Global Internet.

Have you considered using Heroku? Then you will not have the problems
of setting up, maintaining, and especially the securrity issues, of
trying to run your own server.

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

2012/9/30 Mandeep Kaur <meghasimak@gmail.com>:

> Global Internet.

I told you the necessary steps in a mail above. What exactly is not working?

I had neither Rails nor Passenger experience at all when I sat it up
the first time. I was finished in a couple of minutes.

So please tell us, which steps have you done on your WEBSERVER to get
it up and running, which messages did occur, and what is written to
apaches error log when trying to open your domain? What do you see in
your webbrowser then? Are there any messages in
RAILS_ROOT/log/production.log? What do they say?

--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

On Sun, Sep 30, 2012 at 2:03 PM, Colin Law <clanlaw@googlemail.com> wrote:
<snip>
> Do you need the website to be accessible to the global internet or just locally?
>

Global Internet.



--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 30 September 2012 09:28, Mandeep Kaur <meghasimak@gmail.com> wrote:
> On Sun, Sep 30, 2012 at 1:47 PM, Colin Law <clanlaw@googlemail.com> wrote:
> <snip>
>>> I want to start Rails3 app with apache and passenger
>>
>> Just to make sure that you really want to do this can you explain why
>> you want to run with apache and passenger? Please try and explain
>> exactly what you are trying to achieve.
>>
>
> I want to design a websile using RoR. So I am able to link domain name
> with rails app/public folder. But application does not working as to
> run it we have to start it using rails server command then it starts
> application at idaddress:3000.
>
> So how can I link my website to that domain?

Do you need the website to be accessible to the global internet or just locally?

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Sun, Sep 30, 2012 at 1:47 PM, Colin Law <clanlaw@googlemail.com> wrote:
<snip>
>> I want to start Rails3 app with apache and passenger
>
> Just to make sure that you really want to do this can you explain why
> you want to run with apache and passenger? Please try and explain
> exactly what you are trying to achieve.
>

I want to design a websile using RoR. So I am able to link domain name
with rails app/public folder. But application does not working as to
run it we have to start it using rails server command then it starts
application at idaddress:3000.

So how can I link my website to that domain?

--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On 29 September 2012 05:08, Mandeep Kaur <meghasimak@gmail.com> wrote:
> Hello All,
>
> I want to start Rails3 app with apache and passenger

Just to make sure that you really want to do this can you explain why
you want to run with apache and passenger? Please try and explain
exactly what you are trying to achieve.

Colin

> but I am not able
> to do that. I have followed some links but for me its not working or I
> am not getting it properly.
> Here the links that I have followed:
> http://nathanhoad.net/how-to-ruby-on-rails-ubuntu-apache-with-passenger
> https://help.ubuntu.com/community/RubyOnRails#Configure_Apache
>
> Can anyone help me to use passenger and apache with rails3?
> You can also provide any useful link for that or any tutorial.
>
> Thanks in advance.
> Help will be appreciated.
>
> --
> Mandeep Kaur
> http://mandeepsimak.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+unsubscribe@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 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 https://groups.google.com/groups/opt_out.

Ruby on Rails Saturday, September 29, 2012

Hello

I made a quite simple ruby web app. It uses scrubyt and mysql to store
results as cached results. The program is quite simple. It shows a
form, you enter a value and the controller makes an external http
call, parse the data and show the result for the user.

But I have a problem. I have the requirement to let a ruby program
from command line more or less run the same function that on web is
been handled by the form controller.

How can I re-use the web app when doing a standalone program callable
from command line? I dont want to recode as all the app is already
functioning. I am requested to do a ruby program that is called like
this:

ruby ./client.rb some_param

Where should I put this client.rb? How do I use the code from the
application that runs on the web?

--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

Hello ROR community at large,

I am seeking some help for a fairly simply Ruby On Rails/Facebook
project which could help greatly in an intense local anti-fracking
campaign in Colorado.

I am a ROR beginner, but do not have the expertise to knock out this
project quickly; but I have been a database developer for over 20 years,
and can provide excellent support. I am familiar with Engine Yard,
Heroku and github, and hope this project can be done using all open
source, free services.

The need is this: my local anti-fracking group badly needs an online
database to help us support a political campaign against fracking in the
local area. All we need is (1) a data entry form to create a record, and
then (2) a form to allow us to edit a record, then (3) a form to allow
us to download a select list from the database in a csv file.

All of the surrounding communities where I live in Lafayette, CO are
about to be invaded by gas wells getting drilled within the city limits
of our towns, such as Boulder, Longmont, Erie, Lyons, and outlying parts
of Denver, such as Commerce City and Aurora. This is known as the Front
Range, and we are about to become the national battleground of the oil &
gas industry versus alternative energy -- and I need your help.

If you don't know about fracking, but want to find out, go search for
watching the full length documentary GASLAND (gaslandthemovie.com), or
watch "The Sky Is Pink" on YouTube, a short sequel.

Basically, we a simple online database (described above) on a website,
plus a button from our Facebook page for East Boulder County United (see
http://www.facebook.com/EastBoulderCountyUnited?fref=ts)

to the database.

If anybody is willing to help me with this, please let me know at
caseyrick@gmail.com

Thank you for your time,
Rick Casey
Lafayette, CO

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

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

Ruby on Rails

2012/9/29 Mandeep Kaur <meghasimak@gmail.com>:

>
> Then how can I access site without port. Please give some idea how can
> I do this?

When your Apache is configured to listen on port 80 AND apache is
configured to serve a certain VirtualHost via Passenger, THEN no port
in the URL is needed.

The documentation of passenger itself is very straight forward. The
only mistakes you can make is to "name" the VirtualHost wrong, set the
Passenger pathes wrong or put the DocumentRoot into a wrong directory.
If you have none of this wrong, everything should work.

Hint 1: All I say now is for PRODUCTION!
Hint 2: ServerName has to be the domain you bought, or any subdomain
that is resolved to the same IP-Address.
Hint 3: RailsEnv shall be production
Hint 4: PassengerRoot and PassengerRuby should point to the root-dirs
in which the appropriate binaries are located.
Hint 5: After changing apache config don't forget to restart it, can
take hours to find that damn mistake, been there, done that…
Hint 6: Remember to touch that file passenger needs to recognize the
updated app and restart it, after you changed something, also an error
that will eat hours of your life…
Hint 7: Last but not least: Learn to use a deploy-tool like Capistrano
or Vlad, it will make many things easier and do things automatically
that I personally would forget with every deploy (see Hint 5 and 6 :)
)

When none of these Hints help you, you should learn how to find the
various logs apache provides, there will be questions about their
contents then.

--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

On Sat, Sep 29, 2012 at 2:44 PM, Mandeep Kaur <meghasimak@gmail.com> wrote:

> Then how can I access site without port. Please give some idea how can
> I do this?

I'd imagine it's the default for a Passenger installation, but it's been a
long time since I configured one.

What is not working for you at this point? What *exactly* ?

--
Hassan Schroeder ------------------------ hassan.schroeder@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Sat, Sep 29, 2012 at 10:40 PM, Hassan Schroeder
<hassan.schroeder@gmail.com> wrote:
> On Sat, Sep 29, 2012 at 10:03 AM, Mandeep Kaur <meghasimak@gmail.com> wrote:
>
<snip>
> If you're using Passenger, it should be listening on port 80.
>
> Why would you want people to have to add a port # to the URL of
> your site?
>

Then how can I access site without port. Please give some idea how can
I do this?

--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Sat, Sep 29, 2012 at 10:03 AM, Mandeep Kaur <meghasimak@gmail.com> wrote:

> Although I am a student and learning RoR so I am not able to afford that.

I think you missed the point of that story :-)

> But can i link my site to ipaddress:3000 on which rails app is running?

If you're using Passenger, it should be listening on port 80.

Why would you want people to have to add a port # to the URL of
your site?

--
Hassan Schroeder ------------------------ hassan.schroeder@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Sat, Sep 29, 2012 at 10:21 PM, Norbert Melzer <timmelzer@gmail.com> wrote:
<snip>
> Don't repeat mistakes that others did. Make your own, but make them different!
>

Thanks for sharing your experience. I will take care about that.
Although I am a student and learning RoR so I am not able to afford that.
But can i link my site to ipaddress:3000 on which rails app is running?


--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

2012/9/29 jude <judearasu@gmail.com>:
> Is it necessary to write the test cases for the entire rails project,
> or the test cases needed for specific functionalties

Necessary isn't even one single test.

Tests are for you, not for the project.

The are "needed" to make it maintainable, not to make it work.

But as a rule of thumb: A better testcoverage means a much less chance
of breaking functionality when changing or adding aspects of your
project.

--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

2012/9/29 jude <judearasu@gmail.com>:
> Is it necessary to write the test cases for the entire rails project,
> or the test cases needed for specific functionalties

Necessary isn't even one single test.

Tests are for you, not for the project.

The are "needed" to make it maintainable, not to make it work.

But as a rule of thumb: A better testcoverage means a much less chance
of breaking functionality when changing or adding aspects of your
project.

--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

2012/9/29 Mandeep Kaur <meghasimak@gmail.com>:

> I don't think Its the right choice to pay someone for doing that. I
> will try it and hopefully run that too.
> Anyways thanks for your help.

Believe me it is, I had to learn that the hard way a couple of years ago!

Setting up a webserver that it works is one thing, setting it up that
it works AND is secure another thing!

I did some misconfigurations that time and opened a big security hole
in my webserver. No one discovered it in the first place, but about
half a year later, someone used that hole to hack my server and abuse
its processing power for spam mail sending and crawling the web for
more email-addresses. Another problem were the leaked database and its
contents.

Since my hoster realized the high CPU use after a couple of minutes he
shut down that host. I was lucky about that. Since all what happened
was my fault of misconfiguring the server I had to pay fees! But since
the host was shut down very early I wasn't punished for spammail but I
had to pay a fee for the leaked userdata. It summarized to about 2500
€ (about 3000 USD).

Paying someone who knows how to configure such a webserver would have
cost only a fraction, and if I had have a bigger userbase it would
have been much more money!

Don't repeat mistakes that others did. Make your own, but make them different!

--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

Is it necessary to write the test cases for the entire rails project,
or the test cases needed for specific functionalties

--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

On 28 September 2012 09:39, gagan sharma <lists@ruby-forum.com> wrote:
> Hi,
>
> I have to create databases at run time depending on the name of the new
> user's company and to run all the migrations for that new database.
>
> for example: If a new user get registered and enter ABC as his company
> name, then we will check if there is any existing user with same
> company. If we dont have any user for that company then we have to
> create a new Database and name it "ABC". After creating this new
> Database we have to run all the migration for this new Database.

Probably better not to do it this way. Have just one database but add
fields to differentiate which records in each table belong to each
user. The user will not be able to tell the difference between that
and your suggested solution.

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Sat, Sep 29, 2012 at 9:34 PM, Norbert Melzer <timmelzer@gmail.com> wrote:
> Is that server an Ubuntu too?
Yes

> If not many things in configuring apache can differ, at least the files are
> located somewhere else. Also the needed dependencies for passenger will have
> other package names.
>
> But since it seems that you not really know what you are doing, I really
> would suggest you that you search someone who knows and pay him some big cks
> to set everything up. Or else use heroku or another well known rails hosted.
> You could then use the domain of your server with a redirect to heroku.

I don't think Its the right choice to pay someone for doing that. I
will try it and hopefully run that too.
Anyways thanks for your help.


--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Is that server an Ubuntu too?
If not many things in configuring apache can differ, at least the files are located somewhere else. Also the needed dependencies for passenger will have other package names.

But since it seems that you not really know what you are doing, I really would suggest you that you search someone who knows and pay him some big cks to set everything up. Or else use heroku or another well known rails hosted. You could then use the domain of your server with a redirect to heroku.

Am 29.09.2012 17:54 schrieb "Mandeep Kaur" <meghasimak@gmail.com>:
On Sat, Sep 29, 2012 at 7:28 PM, Hassan Schroeder
<hassan.schroeder@gmail.com> wrote:
<snip>>

> Please go read something about the Domain Name System (DNS).
> Then register a domain name for your project so name servers can
> find it.
Ok, Thanks.

> In the meantime, for your own testing purposes, put the name you
> want to use and the server's IP address in your own /etc/hosts file.
> (Remove it when your registered domain is in place.)

I have already buy a domain and server too.


--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@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 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On Sat, Sep 29, 2012 at 7:28 PM, Hassan Schroeder
<hassan.schroeder@gmail.com> wrote:
<snip>>

> Please go read something about the Domain Name System (DNS).
> Then register a domain name for your project so name servers can
> find it.
Ok, Thanks.

> In the meantime, for your own testing purposes, put the name you
> want to use and the server's IP address in your own /etc/hosts file.
> (Remove it when your registered domain is in place.)

I have already buy a domain and server too.


--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Fri, Sep 28, 2012 at 11:36 PM, ruby rails <lists@ruby-forum.com> wrote:
> I have a Task management applciation where users can add task and edit
> it. I am using single form for it. When I render this form for edit and
> new, I need to assign the different form title for each. Say "Edit task"
> and "Assign new task".

You can set the title in the controller methods, or you can set it in a
view helper based on the request path.

--
Hassan Schroeder ------------------------ hassan.schroeder@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Sat, Sep 29, 2012 at 6:40 AM, Mandeep Kaur <meghasimak@gmail.com> wrote:

> I want to build a website using RoR and for that I have to start it
> for all time and to do that I want to use passenger.
> Now what can I do for that?

Your "problem" has nothing to do with RoR or Passenger; it's that you
apparently don't know how the Internet works.

Please go read something about the Domain Name System (DNS).
Then register a domain name for your project so name servers can
find it.

In the meantime, for your own testing purposes, put the name you
want to use and the server's IP address in your own /etc/hosts file.
(Remove it when your registered domain is in place.)

--
Hassan Schroeder ------------------------ hassan.schroeder@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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

On Sat, Sep 29, 2012 at 5:26 PM, Norbert Melzer <timmelzer@gmail.com> wrote:
> When you say domain. Com in the apache configuration than only apache is
> aware of this domain. Firefox just uses the standard way and try to look up
> that name via DNS. Since it can't find anything it says that there is
> nothing. You have to use local host instead or add that domain to your
> /etc/hosts file.
<snip>
> But if you insist, I think we can help you to get it running.
>

Yes for helping me :-)

I want to build a website using RoR and for that I have to start it
for all time and to do that I want to use passenger.
Now what can I do for that?
Or their is another way to start rails app and link it to domain(website).

I have server(which is Linux based) for that work and all I have to do
through console mode. So help me according to that.


--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

simple_form does that



===================
Alexandre Mondaini Calvão

"Nossa recompensa se encontra no esforço e não no resultado. Um esforço total é uma vitória completa." [Ghandi]


2012/9/29 ruby rails <lists@ruby-forum.com>
I have a Task management applciation where users can add task and edit
it. I am using single form for it. When I render this form for edit and
new, I need to assign the different form title for each. Say "Edit task"
and "Assign new task". How do I implement it. I am new to rails. Please
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 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 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 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I would use cancan.



if valid(params[:token])
  authorize! :show, @stuff
end

===================
Alexandre Mondaini Calvão

"Nossa recompensa se encontra no esforço e não no resultado. Um esforço total é uma vitória completa." [Ghandi]


2012/9/29 Christopher R. Maden <crism@maden.org>
On 09/28/2012 06:21 PM, Matt Martini wrote:
> Are there any gems/plug-ins out there for this?  How would I go about
> creating it from scratch?

Not sure about existing gems, not having looked at this in Ruby or
Rails, but having solved it in another language: you create an entry in
your database with a token and a timestamp.  When a user sends the token
back, you check the current time against the token's associated
timestamp, and reject it if the token is unknown or the timestamp is too
old.  (Periodically, you can garden your database to delete any entry
with an old timestamp.)

~Chris
--
Chris Maden, text nerd  <URL: http://crism.maden.org/ >
LIVE FREE: vote for Gary Johnson, Libertarian for President.
     <URL: http://garyjohnson2012.com/ >  <URL: http://lp.org/ >
GnuPG fingerprint: DB08 CF6C 2583 7F55 3BE9  A210 4A51 DBAC 5C5C 3D5E

--
You received 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 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 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

When you say domain. Com in the apache configuration than only apache is aware of this domain. Firefox just uses the standard way and try to look up that name via DNS. Since it can't find anything it says that there is nothing. You have to use local host instead or add that domain to your /etc/hosts file.

But only touch hosts when you know what you are doing. In any other case change your apache conference to use local host and use local host in the browser.

But when developing local it is better to use rails s or a passenger standalone and start it via console when needed. You only need to configure mod.rails local when you want to serve an intranet Page. And that you should only do when you know what you are doing again.

But if you insist, I think we can help you to get it running.

Am 29.09.2012 12:44 schrieb "Mandeep Kaur" <meghasimak@gmail.com>:
On Sat, Sep 29, 2012 at 2:26 PM, Norbert Melzer <timmelzer@gmail.com> wrote:
> Please give us a little bit more information, doesn't work is somewhat
> wage...

Ok

> What error messages do you get, the show us the bits of your configuration.

I have created a virtual link for railsapp/public folder virtual
hosting as mentioned in below link.
http://articles.slicehost.com/2009/2/2/ubuntu-intrepid-using-mod_rails-to-serve-your-application

Then it creates domain.com or www.domain.com for rails app. but when I
open this in browser its not working. Look at the image.

According to me, it should shows rails application but its not doing that.

> Which Version of Ubuntu are you running?

I am using Ubuntu 12.04, Phusion Passenger Application Server and Apache Server
I just want to know how to start Rails app with passenger and apache
without starting it with Webrick(Default app. server).

Now can you help me?


--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@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 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On Sat, Sep 29, 2012 at 2:26 PM, Norbert Melzer <timmelzer@gmail.com> wrote:
> Please give us a little bit more information, doesn't work is somewhat
> wage...

Ok

> What error messages do you get, the show us the bits of your configuration.

I have created a virtual link for railsapp/public folder virtual
hosting as mentioned in below link.
http://articles.slicehost.com/2009/2/2/ubuntu-intrepid-using-mod_rails-to-serve-your-application

Then it creates domain.com or www.domain.com for rails app. but when I
open this in browser its not working. Look at the image.

According to me, it should shows rails application but its not doing that.

> Which Version of Ubuntu are you running?

I am using Ubuntu 12.04, Phusion Passenger Application Server and Apache Server
I just want to know how to start Rails app with passenger and apache
without starting it with Webrick(Default app. server).

Now can you help me?


--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

Please give us a little bit more information, doesn't work is somewhat wage...

What error messages do you get, the show us the bits of your configuration.

Which Version of Ubuntu are you running?

Post anything more I have forgotten

Am 29.09.2012 06:08 schrieb "Mandeep Kaur" <meghasimak@gmail.com>:
Hello All,

I want to start Rails3 app with apache and passenger but I am not able
to do that. I have followed some links but for me its not working or I
am not getting it properly.
Here the links that I have followed:
http://nathanhoad.net/how-to-ruby-on-rails-ubuntu-apache-with-passenger
https://help.ubuntu.com/community/RubyOnRails#Configure_Apache

Can anyone help me to use passenger and apache with rails3?
You can also provide any useful link for that or any tutorial.

Thanks in advance.
Help will be appreciated.

--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@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 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails Friday, September 28, 2012

I have a Task management applciation where users can add task and edit
it. I am using single form for it. When I render this form for edit and
new, I need to assign the different form title for each. Say "Edit task"
and "Assign new task". How do I implement it. I am new to rails. Please
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 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

Stop bumping your question. That is really annoying. 

You haven't posted your code, so how do you expect anyone to give you a meaningful reply? 

Also, if you have done a google search on reading excel files in ruby, you would have known of at least two libraries which read Excel files. Please google next time before posting. If you can't find any results, it does not necessarily mean they don't exist. It just means you are incapable of looking for what you want.

And that does not mean you spam mailing lists with inane questions. 

Learn to ask questions the smart way. Here is a resource for that: http://www.catb.org/esr/faqs/smart-questions.html


Dheeraj Kumar

On Saturday 29 September 2012 at 10:25 AM, Fahim Patel wrote:

any one about this

On Thursday, September 27, 2012 6:48:57 PM UTC+5:30, Fahim Patel wrote:
hi all
i wish to upload a spreadsheet file and all the content of that file should be save in my mysql database.

my code working best with xls 2003 but when i upload xlsx 2007  & 2010 i get error "OLE2 signature is invalid".



What should i do for xlsx 2007  & 2010 ..

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/I0Seo7GemhoJ.
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 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 https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

any one about this

On Thursday, September 27, 2012 6:48:57 PM UTC+5:30, Fahim Patel wrote:

hi all
i wish to upload a spreadsheet file and all the content of that file should be save in my mysql database.

my code working best with xls 2003 but when i upload xlsx 2007  & 2010 i get error "OLE2 signature is invalid".



What should i do for xlsx 2007  & 2010 ..

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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/I0Seo7GemhoJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

On 09/28/2012 06:21 PM, Matt Martini wrote:
> Are there any gems/plug-ins out there for this? How would I go about
> creating it from scratch?

Not sure about existing gems, not having looked at this in Ruby or
Rails, but having solved it in another language: you create an entry in
your database with a token and a timestamp. When a user sends the token
back, you check the current time against the token's associated
timestamp, and reject it if the token is unknown or the timestamp is too
old. (Periodically, you can garden your database to delete any entry
with an old timestamp.)

~Chris
--
Chris Maden, text nerd <URL: http://crism.maden.org/ >
LIVE FREE: vote for Gary Johnson, Libertarian for President.
<URL: http://garyjohnson2012.com/ > <URL: http://lp.org/ >
GnuPG fingerprint: DB08 CF6C 2583 7F55 3BE9 A210 4A51 DBAC 5C5C 3D5E

--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

Hello All,

I want to start Rails3 app with apache and passenger but I am not able
to do that. I have followed some links but for me its not working or I
am not getting it properly.
Here the links that I have followed:
http://nathanhoad.net/how-to-ruby-on-rails-ubuntu-apache-with-passenger
https://help.ubuntu.com/community/RubyOnRails#Configure_Apache

Can anyone help me to use passenger and apache with rails3?
You can also provide any useful link for that or any tutorial.

Thanks in advance.
Help will be appreciated.

--
Mandeep Kaur
http://mandeepsimak.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ruby on Rails

I have a person has many questions model,  I have accepts_nested_Attributes set up properly.  the question from the db show up, but the index is not incrementing:


<%= f.fields_for :person_questions do |pregunta| %>
          Questions: <br/>
          <% Question.all.each do |question| %>
            <%= render 'questions/question_type', :pregunta => pregunta, :question => question, :f => f %>
          <% end %>
        <% end %>
        <div class="control-group">
          <%= f.label :date_of_problema, :class => 'control-label' %>
          <div class="controls">
            <%= f.datepicker :date_of_problema, :class => 'date_select' %>
          </div>
        </div>


partial:

<div class="control-group">
  <%= pregunta.label question.name, (question.label_text unless question.label_text.nil?), :class => 'control-label' %>
  <div class="controls">
    <%= pregunta.send(question.data_type, :option_selected ) %>
    <%= pregunta.hidden_field :question_id, :value => question.id , :class => "#{question.data_type}" %>
  </div>
</div>

Is there a way to get the attribute names to be correct?

The questions come from the db.
chrome inspector:
<input id="person_person_questions_attributes_0_option_selected" name="person[person_questions_attributes][0][option_selected]" type="checkbox" value="1">
<input id="person_person_questions_attributes_0_option_selected" name="person[person_questions_attributes][0][option_selected]" size="30" type="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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/lYzGc04VpAwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

Been a while, I had the closing bracket in the wrong spot:

send needs all the params, it was erroring on , if i put the closing bracket right after the data_type or name
<%= person_question.send(question.data_type.to_sym, question.name, :class => 'text_field') %>

On Monday, July 30, 2012 5:01:42 PM UTC-5, Me wrote:
Can you do f.send in a form?  I have questions and the data type stored in a db.

<% Question.all.each do |question| %>
          <div class="control-group">
            <%= f.send(:label, question.name), :class => 'control-label' %>
            <div class="controls">
              <%= f.send(question.data_type.to_sym, :question, :name) %> - <%= ' allergic to shellfish?' %>
            </div>
          </div>
        
        <% end %>

--
You received 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.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/gR9GK0yFNKEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ruby on Rails

I would like to send a link to a user (via email) that expires after a period of time.

When a user takes a certain action, they are emailed a link that allows them access to a certain resource.
What I want to do is make it so that the link will work for a period of time (say 48 hours) and then will
no longer work. I would like the link to look like:

http://www.mysite.com/stuff/b39a8b314588d04e23f15ceb026196c5
or
http://www.mysite.com/stuff/resourcea?b39a8b314588d04e23f15ceb026196c5

Rails would need to decrypt the url (it doesn't need to be cryptographically secure, but it
should be non obvious), determine if the timeframe is still valid and serve the resource (or not).

I would rather that the timeframe be included in the link instead of having to do a db lookup.

Are there any gems/plug-ins out there for this? How would I go about creating it from scratch?

Matt


--
You received 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 https://groups.google.com/groups/opt_out.

Ruby on Rails

Ok I got it. You're probably right. The validation for the
confirmation field it's related to the comparation with the original
field.

Thanks

2012/9/28 Norbert Melzer <timmelzer@gmail.com>:
> Can't follow you… all the confirmation-fields you probably have, don't
> need to be checked if they are present… That's throwing away CPU
> cycles and therefore money!
>
> It is simple logic:
>
> When all validations pass on the original field they will also pass on
> the corresponding confirmation field, as long as it has the same value
> as the original field. So do all necessary validations on your
> original field, check if it is identical with the confirmation field
> and you are done…
>
> 2012/9/28 enrico stano <enricostn@gmail.com>:
>> Hi,
>>
>> I was writing some tests when I discovered (god bless testing...) that my
>> User model, that use Devise, doesn't validate the presence of the
>> :password_confirmation field.
>>
>> I was expecting that adding :validatable to the Devise option would include
>> the presence validation for this field too.
>>
>> Could any one please explain this behaviour?
>>
>> There is a better solution than simply adding that field to User model
>> validation?
>>
>> thank you.
>>
>> bye,
>>
>> enricostn
>>
>> --
>> You received 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/rubyonrails-talk/-/J_r2Hs92FgsJ.
>> 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 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 https://groups.google.com/groups/opt_out.
>
>



--
· Enrico Stano
·
· twitter @enricostano
· skype ocirneonats

--
You received 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 https://groups.google.com/groups/opt_out.