Ruby on Rails Thursday, May 31, 2012

On 1 June 2012 04:31, flaps <flaps2007@gmail.com> wrote:

Please don't top post, it makes it difficult to follow the thread.
Insert your reply into previous message at appropriate points. Thanks

> THanks for your response. The validation methods are not called on a
> create, allowing the save method to be called, unprotected. I dont
> want the save to be called let alone fail.

As I said previously, the validation methods will be called during the
save, unless you are doing something to call them earlier. I suggest
you post the contents of the create action in the controller so we can
see what is going on.

>
> The validation method should stop the save method from being run and
> redirect the user to the new action/view with errors displayed, right?

The validation methods will not stop save from being called unless you
have included code in the create method to do this. Also any
redirection is up to the code you have written.

>
> The validation methods in the model are called on an update and errors
> reported back to the view. And I dont know why I am getting expected
> validating behaviour with an update but not with a create.
>
> I can post the error logs in the morning, but, on a create, they
> report a rollback, a 500 error, because the failed save call triggers
> the unexpected view to be routed.

Also post the relevant code.

Colin

>
> On May 31, 3:53 pm, Colin Law <clan...@googlemail.com> wrote:
>> On 31 May 2012 20:50, flaps <flaps2...@gmail.com> wrote:
>>
>> > I have a model, Work, that when I create a new instance with incorrect
>> > field data does not call the validation methods. When I update an
>> > existing instance with the same incorrect fields the validation
>> > methods are called.
>>
>> > The create action fails on the save method and re-routes to the new
>> > action, causing runtime errors.
>>
>> The validation /should/ cause the save method to fail, that is the
>> whole point of validation.  Or do you mean that the runtime errors
>> appear /during/ the save?  If so then give us some more information
>> about that (the full error message and stack trace).
>>
>> Colin
>>
>>
>>
>>
>>
>> > I dont understand why update validates correctly and create doesn't.
>>
>> > Validation lines in the model are as follows:
>>
>> > validates :start, :presence => { :message => "must be a valid date/
>> > time" }
>> > validates :end, :presence => {:message => "must be a valid date/
>> > time"}
>> > validate :start_must_be_before_end_time
>>
>> > def start_must_be_before_end_time
>> >    errors.add(:start, "must be before end time") unless
>> >        self.start < self.end
>> > end
>>
>> > Any pointers would be great.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
>> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
>> > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

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

Ruby on Rails

Can any one help to integrate crystal reports with rails:
I was found the below link to integrate crystal reports in my rails
application.....
http://kkarthik.wordpress.com/
but i not understanding how to include those jar files in my rails
application......
i am not getting those jar files for download.........where i will get
those jar files..
(or)
Is there any better and easy way for generating reports??
please help me.....
thanks in advance for your help....
I am looking for your valuable replay....

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

Ruby on Rails

thank you Mr.Capitan it helped me alot.





On Thu, May 31, 2012 at 11:03 PM, Ricardo Pontes <rpontes@gmail.com> wrote:
Nice post. I will use many things of this tutorial

Thanks.

Ricardo Pontes da Silva

rpontes@gmail.com

Facebook Twitter LinkedIn Google Plus


2012/5/30 Capitan Yesterday <marco.sormani@gmail.com>
http://www.html5rocks.com/en/tutorials/file/dndfiles/

If you want a preview before the actual upload, then you should do it
with javascript Files API.

Hope it helps...

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


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

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

Ruby on Rails

Folks
Im using simple_form and im able to see a selection of users from my
drop
down list but im trying to set the default value. Here is what ive tried
<%= f.association :people, :input_html => { :value => 'someval' } %>
i want someval to be set in the selection by default. Any help would be
appreciated.

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

Ruby on Rails

Good news everyone! Rails version 3.2.5 has been released.

This version of Rails is a less broken version of 3.2.4!

## What happened with 3.2.4?

A regression was reported in the release candidate. I reverted that
regression without releasing another release candidate for testing.
This release fixes the original regression along with the error made
during reverting.

## CHANGES

This release only contains a few changes, mainly reverting bad commits.
Please check out the commit list on github:

https://github.com/rails/rails/compare/v3.2.4...v3.2.5

Thanks to everyone, especially @pixeltrix and @rafaelfranca, for
putting up with me!

<3<3<3

--
Aaron Patterson
http://tenderlovemaking.com/

Ruby on Rails

Quoting BeagleBen <steven@stevencahill.co.uk>:
> Hello all
>
> I am returning to rails after a moving in with asp.net mvc for a while, I
> have setup rails on a centos server with passenger, I have set the rails
> environment as production within my httpd config, when I do rake about it
> show the environment as development, Please can anyone advise what I have
> missed.
>

You are running production in your webserver (presumably on port 80) and
development on the command line. This is normal. They are separate contexts.
The httpd config only applies to the Web server, not a terminal session. If
you would start Webrick or other Rails server from the command line, it would
run the development environment on port 3000. If you want to run in
production mode from the command line, type "export RAILS_ENV=production" in
bash or the equivalent in other shells (e.g. "RAILS_ENV=production; export
RAILS_ENV" in sh).

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

Ruby on Rails

THanks for your response. The validation methods are not called on a
create, allowing the save method to be called, unprotected. I dont
want the save to be called let alone fail.

The validation method should stop the save method from being run and
redirect the user to the new action/view with errors displayed, right?

The validation methods in the model are called on an update and errors
reported back to the view. And I dont know why I am getting expected
validating behaviour with an update but not with a create.

I can post the error logs in the morning, but, on a create, they
report a rollback, a 500 error, because the failed save call triggers
the unexpected view to be routed.

On May 31, 3:53 pm, Colin Law <clan...@googlemail.com> wrote:
> On 31 May 2012 20:50, flaps <flaps2...@gmail.com> wrote:
>
> > I have a model, Work, that when I create a new instance with incorrect
> > field data does not call the validation methods. When I update an
> > existing instance with the same incorrect fields the validation
> > methods are called.
>
> > The create action fails on the save method and re-routes to the new
> > action, causing runtime errors.
>
> The validation /should/ cause the save method to fail, that is the
> whole point of validation.  Or do you mean that the runtime errors
> appear /during/ the save?  If so then give us some more information
> about that (the full error message and stack trace).
>
> Colin
>
>
>
>
>
> > I dont understand why update validates correctly and create doesn't.
>
> > Validation lines in the model are as follows:
>
> > validates :start, :presence => { :message => "must be a valid date/
> > time" }
> > validates :end, :presence => {:message => "must be a valid date/
> > time"}
> > validate :start_must_be_before_end_time
>
> > def start_must_be_before_end_time
> >    errors.add(:start, "must be before end time") unless
> >        self.start < self.end
> > end
>
> > Any pointers would be great.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.

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

Ruby on Rails

Maaaaaaaaaaaaaaaaaaaaaan *--* thank you so much... !!!!!

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

Ruby on Rails

Hi Felipe!

Try this, please:

gem 'therubyracer', :platform => :ruby

I found this on Stack Overflow:

http://stackoverflow.com/questions/6356450/therubyracer-gem-on-windows

They said that you don't need to install therubyracer on Windows,
because the OS already comes with a Javascript Runtime Environment

Best Regards,
Everaldo

On Thu, May 31, 2012 at 8:23 PM, Felipe Pieretti Umpierre
<lists@ruby-forum.com> wrote:
> Hello Everaldo, thank you for the answer, but I have installed the
> Python:
>
> C:\Python27
>
> and this error still there :D
>
> Thank you.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

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

Ruby on Rails

Hello Everaldo, thank you for the answer, but I have installed the
Python:

C:\Python27

and this error still there :D

Thank you.

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

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

Ruby on Rails

Hello all

I am returning to rails after a moving in with asp.net mvc for a while, I have setup rails on a centos server with passenger, I have set the rails environment as production within my httpd config, when I do rake about it show the environment as development, Please can anyone advise what I have missed.

Thank you in advance

Beagle


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

Ruby on Rails

I believe this is a missing feature/bug, but when I tried to file an
issue (https://github.com/rails/rails/issues/6573) I was told to post
it here instead. So, okay, doing my duty! I suspect that nobody will
pay any attention to this, and a year from now when someone google's
for this issue this post is going to be all they find, but I'd love to
be proven wrong!

I believe there is no way using the standard supported Rails testing
framework to test routes from an `isolated` engine. Or to test helpers
that use these routes.

I believe there is no way to test isolated engine helpers or use
isolated engine helpers in tests. But I'd be pleased if I'm wrong and
I'm just missing something.

If you create an isolated engine, then the dummy app has a config/
routes that has for instance mount Widget::Engine => "/widget"

If the Widget engines has it's own config/routes, then ordinarily an
app with that line in it would be able to access the engine's route
path helpers as widget.some_path.

That works in the app. But it does not work in the test environment.
No such method widget, the widget. method isn't installed in the test
environment.

The main engine root widget_path => /widget is installed in the
testing environment, you can use it in tests and test routing
involving that named helper and path. But not any of the specific
widget routes that would ordinarily, in an actual app, be available at
widget.some_path.

Phew, this is confusing to talk about, hope this is understandable.

I guess I'll keep hacking away at it and looking at Rails source,
maybe file a pull request if I can figure out what's going on, but
this is very convoluted code, even before you pull the testing
environment into it.

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

Ruby on Rails

Hi!

It seems that you need to install Python:

make: python: Command not found



On Thu, May 31, 2012 at 6:02 PM, Felipe Pieretti Umpierre
<lists@ruby-forum.com> wrote:
> Hello, I have a problem when I try to add the gem therubyracer.
>
> I put in my prompt:
>
> bundle install, and this error appears:
>
> C:\rails\organily>bundle install
> Fetching gem metadata from https://rubygems.org/.........
> Using rake (0.9.2.2)
> Using i18n (0.6.0)
> Using multi_json (1.3.6)
> Using activesupport (3.2.3)
> Using builder (3.0.0)
> Using activemodel (3.2.3)
> Using erubis (2.7.0)
> Using journey (1.0.3)
> Using rack (1.4.1)
> Using rack-cache (1.2)
> Using rack-test (0.6.1)
> Using hike (1.2.1)
> Using tilt (1.3.3)
> Using sprockets (2.1.3)
> Using actionpack (3.2.3)
> Using mime-types (1.18)
> Using polyglot (0.3.3)
> Using treetop (1.4.10)
> Using mail (2.4.4)
> Using actionmailer (3.2.3)
> Using arel (3.0.2)
> Using tzinfo (0.3.33)
> Using activerecord (3.2.3)
> Using activeresource (3.2.3)
> Using bundler (1.2.0.pre.1)
> Using coffee-script-source (1.3.3)
> Using execjs (1.4.0)
> Using coffee-script (2.2.0)
> Using rack-ssl (1.3.2)
> Using json (1.7.3)
> Using rdoc (3.12)
> Using thor (0.14.6)
> Using railties (3.2.3)
> Using coffee-rails (3.2.2)
> Using jquery-rails (2.0.2)
> Using libv8 (3.10.8.0)
> Using mysql (2.8.1)
> Using rails (3.2.3)
> Using sass (3.1.19)
> Using sass-rails (3.2.5)
> Using sqlite3 (1.3.6)
> Installing therubyracer (0.8.2) with native extensions
> Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
> extension
> .
>
>        C:/Ruby193/bin/ruby.exe extconf.rb
> mkdir -p build
> cp -r scons build
> mkdir -p build/scons/install
> python build/scons/setup.py install --prefix=install
> make: python: Command not found
> make: *** [build/scons/install/bin/scons] Error 127
> *** extconf.rb failed ***
> Could not create Makefile due to some reason, probably lack of
> necessary libraries and/or headers.  Check the mkmf.log file for more
> details.  You may need configuration options.
>
> Provided configuration options:
>        --with-opt-dir
>        --without-opt-dir
>        --with-opt-include
>        --without-opt-include=${opt-dir}/include
>        --with-opt-lib
>        --without-opt-lib=${opt-dir}/lib
>        --with-make-prog
>        --without-make-prog
>        --srcdir=.
>        --curdir
>        --ruby=C:/Ruby193/bin/ruby
> extconf.rb:10:in `<main>': Error compiling V8 (RuntimeError)
> Compiling V8
>
>
> Gem files will remain installed in
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/therubyra
> cer-0.8.2 for inspection.
> Results logged to
> C:/Ruby193/lib/ruby/gems/1.9.1/gems/therubyracer-0.8.2/ext/v8/
> gem_make.out
> An error occurred while installing therubyracer (0.8.2), and Bundler
> cannot cont
> inue.
> Make sure that `gem install therubyracer -v '0.8.2'` succeeds before
> bundling.
>
> How can I solve this ?
>
> Thank you.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

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

Ruby on Rails

Hello, I have a problem when I try to add the gem therubyracer.

I put in my prompt:

bundle install, and this error appears:

C:\rails\organily>bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
Using activesupport (3.2.3)
Using builder (3.0.0)
Using activemodel (3.2.3)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.3)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.3)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.3)
Using activeresource (3.2.3)
Using bundler (1.2.0.pre.1)
Using coffee-script-source (1.3.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.3)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.3)
Using coffee-rails (3.2.2)
Using jquery-rails (2.0.2)
Using libv8 (3.10.8.0)
Using mysql (2.8.1)
Using rails (3.2.3)
Using sass (3.1.19)
Using sass-rails (3.2.5)
Using sqlite3 (1.3.6)
Installing therubyracer (0.8.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension
.

C:/Ruby193/bin/ruby.exe extconf.rb
mkdir -p build
cp -r scons build
mkdir -p build/scons/install
python build/scons/setup.py install --prefix=install
make: python: Command not found
make: *** [build/scons/install/bin/scons] Error 127
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby193/bin/ruby
extconf.rb:10:in `<main>': Error compiling V8 (RuntimeError)
Compiling V8


Gem files will remain installed in
C:/Ruby193/lib/ruby/gems/1.9.1/gems/therubyra
cer-0.8.2 for inspection.
Results logged to
C:/Ruby193/lib/ruby/gems/1.9.1/gems/therubyracer-0.8.2/ext/v8/
gem_make.out
An error occurred while installing therubyracer (0.8.2), and Bundler
cannot cont
inue.
Make sure that `gem install therubyracer -v '0.8.2'` succeeds before
bundling.

How can I solve this ?

Thank you.

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

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

Ruby on Rails

I'm running Rails 2.3.12 over MySQL and I believe I hit an incredibly odd scenario and wanted input on how this could be possible.


I had appear to have had a errant process that while handling a request go into a transaction, somehow fell out of it (this is the part I'm unclear on), then continued handling further requests while believing itself to be in a transaction. This caused the process so begin picking up DB locks everywhere without releasing them because the final commit never came through while handling new requests and this process also showed indications of having a stale view of the DB while actually working on incoming requests (boom). After killing and restarting the DB, this process began complaining about being unable to rollback to a save point.

I'm fairly confident that the process handled a nested transaction request, fell out of child transaction but not the parent transaction and went on its very un-merry way. (All transactions, I believe, are nested with the require_new option to be true). I'm not a big expert on Rails so I'm curious how this could even be possible. It seems like it shouldn't given that transaction take place in blocks so the blocks shouldn't cross into multiple requests. If it is, shouldn't Rails check its transaction state between requests? Shouldn't it enforce that the state of a request begin without being in a transaction? Has this ever happened before to someone?

Thanks.

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

Ruby on Rails

On 31 May 2012 20:50, flaps <flaps2007@gmail.com> wrote:
> I have a model, Work, that when I create a new instance with incorrect
> field data does not call the validation methods. When I update an
> existing instance with the same incorrect fields the validation
> methods are called.
>
> The create action fails on the save method and re-routes to the new
> action, causing runtime errors.

The validation /should/ cause the save method to fail, that is the
whole point of validation. Or do you mean that the runtime errors
appear /during/ the save? If so then give us some more information
about that (the full error message and stack trace).

Colin

>
> I dont understand why update validates correctly and create doesn't.
>
> Validation lines in the model are as follows:
>
> validates :start, :presence => { :message => "must be a valid date/
> time" }
> validates :end, :presence => {:message => "must be a valid date/
> time"}
> validate :start_must_be_before_end_time
>
> def start_must_be_before_end_time
>    errors.add(:start, "must be before end time") unless
>        self.start < self.end
> end
>
> Any pointers would be great.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

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

Ruby on Rails

Hi there!

I searched a while on the web, but could find aged data only, so I
wanted to ask here:

Is there a german mailinglist for Rails and/or is there a german
usergroup about rails with regular meetings near hannover?

Thanks in advance,
Norbert

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

Ruby on Rails

Hey guys.

I finally got "The RSpec book" and afte reading some pages I'm really
confident it was the right choice. I already learned that Cucumber first
was planned to be a part of RSpec, and so it still is an integral part
of it. The book teaches how to use both of them and in which areas one
should use the one or the other. This is exactly what I've been looking
for.

Thanks again for your replies. I'm enjoying diving into BDD! :)

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

Ruby on Rails

I have a model, Work, that when I create a new instance with incorrect
field data does not call the validation methods. When I update an
existing instance with the same incorrect fields the validation
methods are called.

The create action fails on the save method and re-routes to the new
action, causing runtime errors.

I dont understand why update validates correctly and create doesn't.

Validation lines in the model are as follows:

validates :start, :presence => { :message => "must be a valid date/
time" }
validates :end, :presence => {:message => "must be a valid date/
time"}
validate :start_must_be_before_end_time

def start_must_be_before_end_time
errors.add(:start, "must be before end time") unless
self.start < self.end
end

Any pointers would be great.

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

Ruby on Rails

Good news everyone! Rails version 3.2.4 has been released.

This release of Rails contains two important security fixes:

* CVE-2012-2660 Ruby on Rails Active Record Unsafe Query Generation Risk
* CVE-2012-2661 Ruby on Rails Active Record SQL Injection Vulnerability

It is suggested that all users upgrade immediately. For more information about
these issues, please see the annoumcenents on the rubyonrails-security
mailing list:

https://groups.google.com/group/rubyonrails-security

Specifically these announcements:

https://groups.google.com/group/rubyonrails-security/browse_thread/thread/f1203e3376acec0f
https://groups.google.com/group/rubyonrails-security/browse_thread/thread/7546a238e1962f59

Other changes for this release can be found in each component's CHANGELOG:

https://github.com/rails/rails/blob/3-2-stable/actionmailer/CHANGELOG.md
https://github.com/rails/rails/blob/3-2-stable/actionpack/CHANGELOG.md
https://github.com/rails/rails/blob/3-2-stable/activemodel/CHANGELOG.md
https://github.com/rails/rails/blob/3-2-stable/activerecord/CHANGELOG.md
https://github.com/rails/rails/blob/3-2-stable/activesupport/CHANGELOG.md
https://github.com/rails/rails/blob/3-2-stable/railties/CHANGELOG.md

All changes can be found here:

https://github.com/rails/rails/compare/v3.2.3...v3.2.4

I want to give a special thanks to Ben Murphy for responsibly reporting the two
security issues that are fixed in this release. Thank you very much!

<3<3<3

--
Aaron Patterson
http://tenderlovemaking.com/

Ruby on Rails

Good news everyone! Rails version 3.1.5 has been released.

This release of Rails contains two important security fixes:

* CVE-2012-2660 Ruby on Rails Active Record Unsafe Query Generation Risk
* CVE-2012-2661 Ruby on Rails Active Record SQL Injection Vulnerability

It is suggested that all users upgrade immediately. For more information about
these issues, please see the annoumcenents on the rubyonrails-security
mailing list:

https://groups.google.com/group/rubyonrails-security

Specifically these announcements:

https://groups.google.com/group/rubyonrails-security/browse_thread/thread/f1203e3376acec0f
https://groups.google.com/group/rubyonrails-security/browse_thread/thread/7546a238e1962f59

Other changes for this release can be found in each component's CHANGELOG:

https://github.com/rails/rails/blob/3-1-stable/actionmailer/CHANGELOG.md
https://github.com/rails/rails/blob/3-1-stable/actionpack/CHANGELOG.md
https://github.com/rails/rails/blob/3-1-stable/activemodel/CHANGELOG.md
https://github.com/rails/rails/blob/3-1-stable/activerecord/CHANGELOG.md
https://github.com/rails/rails/blob/3-1-stable/activesupport/CHANGELOG.md
https://github.com/rails/rails/blob/3-1-stable/railties/CHANGELOG.md

All changes can be found here:

https://github.com/rails/rails/compare/v3.1.4...v3.1.5

I want to give a special thanks to Ben Murphy for responsibly reporting the two
security issues that are fixed in this release. Thank you very much!

<3<3<3

--
Aaron Patterson
http://tenderlovemaking.com/

Ruby on Rails

Good news everyone! Rails version 3.0.13 has been released.

This release of Rails contains two important security fixes:

* CVE-2012-2660 Ruby on Rails Active Record Unsafe Query Generation Risk
* CVE-2012-2661 Ruby on Rails Active Record SQL Injection Vulnerability

It is suggested that all users upgrade immediately. For more information about
these issues, please see the annoumcenents on the rubyonrails-security
mailing list:

https://groups.google.com/group/rubyonrails-security

Specifically these announcements:

https://groups.google.com/group/rubyonrails-security/browse_thread/thread/f1203e3376acec0f
https://groups.google.com/group/rubyonrails-security/browse_thread/thread/7546a238e1962f59

Other changes for this release can be found in each component's CHANGELOG:

https://github.com/rails/rails/blob/3-0-stable/actionmailer/CHANGELOG
https://github.com/rails/rails/blob/3-0-stable/actionpack/CHANGELOG
https://github.com/rails/rails/blob/3-0-stable/activemodel/CHANGELOG
https://github.com/rails/rails/blob/3-0-stable/activerecord/CHANGELOG
https://github.com/rails/rails/blob/3-0-stable/activesupport/CHANGELOG
https://github.com/rails/rails/blob/3-0-stable/railties/CHANGELOG

All changes can be found here:

https://github.com/rails/rails/compare/v3.0.12...v3.0.13

I want to give a special thanks to Ben Murphy for responsibly reporting the two
security issues that are fixed in this release. Thank you very much!

<3<3<3

--
Aaron Patterson
http://tenderlovemaking.com/

Ruby on Rails

Hello,

We are using JRuby 1.5.1/ruby 1.8.7/Rails 2.3.8 with a GWT front end.

I'm having an issue when attempting to send a server side .csv file to
the user using rails send_file.

my code is:

send_file(path_to_file, type=>'text/csv')

While this is returning fine with an http status of 200, the client
side save as dialog is never opening for the user to receive the file.
Any ideas why this isn't working?



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

Ruby on Rails

Nice, I forgot about that too...

On Thu, May 31, 2012 at 2:26 PM, Mohamad El-Husseini
<husseini.mel@gmail.com> wrote:
> I forgot to mention that where() returns an array where as find_by_foo
> returns a single object unless there are multiple objects...
>
> -----
>
> Another way would be to change:
>
> roles = user.roles.find_by_account_id(account.id)
>
> to
>
> roles = user.roles.where(account_id: account.id)
>
> On Thursday, May 31, 2012 1:25:49 PM UTC-4, Mohamad El-Husseini wrote:
>>
>> Another way would be to change:
>>
>> roles = user.roles.find_by_account_id(account.id)
>>
>> to
>>
>> roles = user.roles.where(account_id: account.id)
>>
>> On Thursday, May 31, 2012 1:22:42 PM UTC-4, Everaldo Gomes wrote:
>>>
>>> Hi!
>>>
>>> There are many ways to solve this problem.
>>>
>>> One sugestion, maybe not the better: you can use the method kind_of?
>>> to see if roles is a Array.
>>>
>>> roles.kind_of? Array
>>> (will return true)
>>>
>>> Then, you could build your logic upon this.
>>>
>>> Best Regards,
>>> Everaldo
>>>
>>> On Thu, May 31, 2012 at 2:04 PM, Mohamad El-Husseini
>>> <husseini.mel@gmail.com> wrote:
>>> > I'm trying to use CanCan to an account scoped application. I wrote this
>>> > method in my ability class:
>>> >
>>> >     roles = user.roles.find_by_account_id(account.id)
>>> >     if roles.any? { |role| role.type == "Ownership" }
>>> >       can :edit, Account
>>> >     else
>>> >       can :read, :all
>>> >     end
>>> >
>>> > The trouble is, "any?" works when "roles" is an array. Sometimes,
>>> > however,
>>> > user.roles returns only one object any other times my return nil. So
>>> > calling
>>> > roles.any? causes an error. How do I work around this?
>>> >
>>> > My setup is User has_many Accounts through :roles, and vice-versa.
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "Ruby on Rails: Talk" group.
>>> > To view this discussion on the web visit
>>> > https://groups.google.com/d/msg/rubyonrails-talk/-/mORQoYLqDtwJ.
>>> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> > rubyonrails-talk+unsubscribe@googlegroups.com.
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/o9ZLULIE9hoJ.
>
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.

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

Ruby on Rails

Nice post. I will use many things of this tutorial


Thanks.

Ricardo Pontes da Silva

rpontes@gmail.com

Facebook Twitter LinkedIn Google Plus


2012/5/30 Capitan Yesterday <marco.sormani@gmail.com>
http://www.html5rocks.com/en/tutorials/file/dndfiles/

If you want a preview before the actual upload, then you should do it
with javascript Files API.

Hope it helps...

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


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

Ruby on Rails

I forgot to mention that where() returns an array where as find_by_foo returns a single object unless there are multiple objects...

-----

Another way would be to change:

roles = user.roles.find_by_account_id(account.id)

to

roles = user.roles.where(account_id: account.id)

On Thursday, May 31, 2012 1:25:49 PM UTC-4, Mohamad El-Husseini wrote:
Another way would be to change:

roles = user.roles.find_by_account_id(account.id)

to

roles = user.roles.where(account_id: account.id)

On Thursday, May 31, 2012 1:22:42 PM UTC-4, Everaldo Gomes wrote:
Hi!

There are many ways to solve this problem.

One sugestion, maybe not the better: you can use the method kind_of?
to see if roles is a Array.

roles.kind_of? Array
(will return true)

Then, you could build your logic upon this.

Best Regards,
Everaldo

On Thu, May 31, 2012 at 2:04 PM, Mohamad El-Husseini
<husseini.mel@gmail.com> wrote:
> I'm trying to use CanCan to an account scoped application. I wrote this
> method in my ability class:
>
>     roles = user.roles.find_by_account_id(account.id)
>     if roles.any? { |role| role.type == "Ownership" }
>       can :edit, Account
>     else
>       can :read, :all
>     end
>
> The trouble is, "any?" works when "roles" is an array. Sometimes, however,
> user.roles returns only one object any other times my return nil. So calling
> roles.any? causes an error. How do I work around this?
>
> My setup is User has_many Accounts through :roles, and vice-versa.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/mORQoYLqDtwJ.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.

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

Ruby on Rails

Another way would be to change:


roles = user.roles.find_by_account_id(account.id)

to

roles = user.roles.where(account_id: account.id)

On Thursday, May 31, 2012 1:22:42 PM UTC-4, Everaldo Gomes wrote:
Hi!

There are many ways to solve this problem.

One sugestion, maybe not the better: you can use the method kind_of?
to see if roles is a Array.

roles.kind_of? Array
(will return true)

Then, you could build your logic upon this.

Best Regards,
Everaldo

On Thu, May 31, 2012 at 2:04 PM, Mohamad El-Husseini
<husseini.mel@gmail.com> wrote:
> I'm trying to use CanCan to an account scoped application. I wrote this
> method in my ability class:
>
>     roles = user.roles.find_by_account_id(account.id)
>     if roles.any? { |role| role.type == "Ownership" }
>       can :edit, Account
>     else
>       can :read, :all
>     end
>
> The trouble is, "any?" works when "roles" is an array. Sometimes, however,
> user.roles returns only one object any other times my return nil. So calling
> roles.any? causes an error. How do I work around this?
>
> My setup is User has_many Accounts through :roles, and vice-versa.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/mORQoYLqDtwJ.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.

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

Ruby on Rails

Hi!

There are many ways to solve this problem.

One sugestion, maybe not the better: you can use the method kind_of?
to see if roles is a Array.

roles.kind_of? Array
(will return true)

Then, you could build your logic upon this.

Best Regards,
Everaldo

On Thu, May 31, 2012 at 2:04 PM, Mohamad El-Husseini
<husseini.mel@gmail.com> wrote:
> I'm trying to use CanCan to an account scoped application. I wrote this
> method in my ability class:
>
>     roles = user.roles.find_by_account_id(account.id)
>     if roles.any? { |role| role.type == "Ownership" }
>       can :edit, Account
>     else
>       can :read, :all
>     end
>
> The trouble is, "any?" works when "roles" is an array. Sometimes, however,
> user.roles returns only one object any other times my return nil. So calling
> roles.any? causes an error. How do I work around this?
>
> My setup is User has_many Accounts through :roles, and vice-versa.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/mORQoYLqDtwJ.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.

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

Ruby on Rails

I'm trying to use CanCan to an account scoped application. I wrote this method in my ability class:


    roles = user.roles.find_by_account_id(account.id)
    if roles.any? { |role| role.type == "Ownership" }
      can :edit, Account
    else
      can :read, :all
    end

The trouble is, "any?" works when "roles" is an array. Sometimes, however, user.roles returns only one object any other times my return nil. So calling roles.any? causes an error. How do I work around this?

My setup is User has_many Accounts through :roles, and vice-versa.

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

Ruby on Rails

Assuming that you want to use it within the browser, I'm afraid you have to create another program for that.

I've seen people create a Java Applet to access external devices from the browser. That I known it will work.

But assuming you just want to integrate biometrics data monitoring and visualization, I believe that the best way is to create a
diferent desktop/embedded application just to communicate with the server and register the data.

2012/5/31 Colin Law <clanlaw@googlemail.com>
On 31 May 2012 14:18, Walter Lee Davis <waltd@wdstudio.com> wrote:
>
> On May 31, 2012, at 6:47 AM, ashutosh verma wrote:
>
>> I am using Project fedena for School Management software a ROR application. i want to attach  a biometric device for students & employee attendance , any one can suggest me how i can do it.
>>
>
> What sort of biometric device is this? I haven't worked with any of those, but I have worked with bar-code scanners, and the way they work is that they basically emulate a keyboard typing really quickly. You click or tab into the text field that the bar-code belongs in, and pull the trigger, and the code is inserted in the text field.

Assuming that you want the device connected to the client PC (rather
than the server) then you could have a problem accessing it from the
browser.

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




--
Pedro Henrique de Souza Medeiros
----------------------------------
Cel: +55 (61) 9197-0993
Email: pedrosnk@gmail.com

Beautiful is better than ugly,
Explicit is better than implicit,
Simple is better than complex,
Complex is better than complicated.

The Zen of Python, by Tim Peters


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

Ruby on Rails

Hey!


For a quick start i recommend http://tryruby.org/ and http://railsforzombies.com/  which is free, quick and you will get some foundations on rails and ruby lang.

It's possible install some scripts using rubygems library.

If it's not what you are looking for, let us known your actual problem you are trying to solve.

2012/5/31 Colin Law <clanlaw@googlemail.com>
On 30 May 2012 04:03, Matthew Hawley <matthew6d@gmail.com> wrote:
> Hello. Im only used to PHP and Perl/CGI scripts. Ruby scripts are VERY
> confusing. I have no idea how to install ruby script. Could somebody plaese
> tell me how?

What do you mean by a ruby script?  Is it just a .rb file?  In which
case make sure ruby is installed then run it by
ruby the_file.rb

If you are talking about a Ruby on Rails application then I suggest
you work through a Rails tutorial such as railstutorial.org (which is
free to use online) to find out what Rails is about.

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




--
Pedro Henrique de Souza Medeiros
----------------------------------
Cel: +55 (61) 9197-0993
Email: pedrosnk@gmail.com

Beautiful is better than ugly,
Explicit is better than implicit,
Simple is better than complex,
Complex is better than complicated.

The Zen of Python, by Tim Peters


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

Ruby on Rails

it seens like it is a issue within the rails form helper itself


I've tried to do what you described and got the same problem, even by using only form_for @model

But you can always write the the value that you want with input_html

<%= f.input :name,  :input_html => { :value => @model.name } %>

it works, but is not the better way, if I were you I would might consider using a class method that will be responsable to return the value you wanted into the "get method"

2012/5/30 Amit Ambardekar <amitamb@gmail.com>
I have simple problem with overriding attribute readers and seeing same changes appear on simple_form. I have a model and it has some attributes that I want to override with different readers. I did something like following

class CustomerSupplierItem < ActiveRecord:Base

  # it has attribute called pack

  def pack
    "Some overridden value"
  end

end

Now when I use the model in simple_form

<%= simple_form_for @customer_supplier_item do |f| %>
  <%= f.input :pack %>
<% end %>

I do not get "Some overridden value" as value in pack input. I see original pack value without overridden attr_reader.

What is the way to override the attr_reader such that is affects simple_form and similar form helpers?

Regards
Amit

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



--
Pedro Henrique de Souza Medeiros
----------------------------------
Cel: +55 (61) 9197-0993
Email: pedrosnk@gmail.com

Beautiful is better than ugly,
Explicit is better than implicit,
Simple is better than complex,
Complex is better than complicated.

The Zen of Python, by Tim Peters


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

Ruby on Rails

On 31 May 2012 14:18, Walter Lee Davis <waltd@wdstudio.com> wrote:
>
> On May 31, 2012, at 6:47 AM, ashutosh verma wrote:
>
>> I am using Project fedena for School Management software a ROR application. i want to attach  a biometric device for students & employee attendance , any one can suggest me how i can do it.
>>
>
> What sort of biometric device is this? I haven't worked with any of those, but I have worked with bar-code scanners, and the way they work is that they basically emulate a keyboard typing really quickly. You click or tab into the text field that the bar-code belongs in, and pull the trigger, and the code is inserted in the text field.

Assuming that you want the device connected to the client PC (rather
than the server) then you could have a problem accessing it from the
browser.

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

Ruby on Rails

On May 31, 2012, at 6:47 AM, ashutosh verma wrote:

> I am using Project fedena for School Management software a ROR application. i want to attach a biometric device for students & employee attendance , any one can suggest me how i can do it.
>

What sort of biometric device is this? I haven't worked with any of those, but I have worked with bar-code scanners, and the way they work is that they basically emulate a keyboard typing really quickly. You click or tab into the text field that the bar-code belongs in, and pull the trigger, and the code is inserted in the text field.

Maybe that's a starting point for you to investigate.

Walter

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

Ruby on Rails

On 30 May 2012 10:51, Shalini Sah <shalinisah6692@gmail.com> wrote:
> Hi,
>
> I have a database with multiple tables. How do I directly pick the
> information from the database and populate my model folder with
> classes instead of doing it manually? Can some one direct me to the
> specific set of commands for this.

There may be a way of doing this but I do not know it. Note though
that it is easy to do by hand. For each table (table widgets for
example) make a file widget.rb and in there put

class Widget < ActiveRecord::Base
end

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

Ruby on Rails

I am following Michael Hartl's Tutorial on RoR. During the 3rd Chapter
(sample_app), I am trying to install the gems via the "bundle install
--without production command" but I keep encountering the following
issue:


Bundler could not find compatible versions for gem "railties":
In Gemfile:
rails (= 3.2.3) ruby depends on
railties (= 3.2.3) ruby

jquery-rails (= 2.0.0) ruby depends on
railties (3.2.4.rc1)

On using the terminal to install jquery-rail, i.e. "gem install jquery-
rails -v '2.0.0'", I get successfully installed. But after I do
"bundle install", the same dependency issue crops up.

Another thing, my local gem file shows that I do have "railties -v
3.2.3", so why the error showing up?

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

Ruby on Rails

On 30 May 2012 04:03, Matthew Hawley <matthew6d@gmail.com> wrote:
> Hello. Im only used to PHP and Perl/CGI scripts. Ruby scripts are VERY
> confusing. I have no idea how to install ruby script. Could somebody plaese
> tell me how?

What do you mean by a ruby script? Is it just a .rb file? In which
case make sure ruby is installed then run it by
ruby the_file.rb

If you are talking about a Ruby on Rails application then I suggest
you work through a Rails tutorial such as railstutorial.org (which is
free to use online) to find out what Rails is about.

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

Ruby on Rails

On 30 May 2012 00:03, Matthew Hawley <matthew6d@gmail.com> wrote:
Hello. Im only used to PHP and Perl/CGI scripts. Ruby scripts are VERY confusing. I have no idea how to install ruby script. Could somebody plaese tell me how?

Thank you.

You don't install a Ruby script. You run it, much like a PHP script. You need to have the interpreter (Ruby) and whatever dependencies your script has beforehand, then just run:

$ ruby some_script.rb

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

Ruby on Rails

If you are letting the request go through the Rails stack already I
don't see how you can make the response go any faster either way. If
you were catching the request in the middleware on its way to the
Rails stack and returned right away without going through Rails then
it would be a different story and the response would be faster.

On May 31, 4:20 am, Muruga <murugu2...@gmail.com> wrote:
> Hi All
>            I need an solution that i should catch response and based
> on some conditions i have to modify response body and send back to
> client.
>
>       I have tried with a Middleware and got a solution.Can i use a
> Middleware or simply one after_filter.
> On performance wise which is best.Or is there any other ways to do it.
>
>                            thanks in advance.

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

Ruby on Rails

On 31 May 2012 11:53, Mauro <mrsanna1@gmail.com> wrote:
> On 31 May 2012 12:38, Colin Law <clanlaw@googlemail.com> wrote:
>> On 31 May 2012 09:40, Mauro <mrsanna1@gmail.com> wrote:
>>> Hello.
>>> I need an advice to find a solution on creating a new has_many
>>> :through association on a existing model.
>>> I have:
>>>
>>> Company
>>>  has_many :managements, :dependent => :destroy
>>>  has_many :managers, :through => :managements
>>>
>>> Manager
>>>  has_many :managements, :dependent => :destroy
>>>  has_many :companies, :through => :managements
>>>
>>> With the command
>>> link_to "Add manager", new_company_manager_url(@company), :class =>
>>> "btn", :remote => true
>>>
>>> I display the manager form, create a new manager associated to the
>>> company and create a new management.
>>> In manager controller:
>>>
>>> def create
>>>    @company = Company.find(params[:company_id])
>>>    @manager = Manager.new(params[:manager])
>>>    add_management
>>>    @manager.save
>>>    respond_with @manager
>>> end
>>>
>>> private
>>>  def add_management
>>>    profile = params[:manager][:profile]
>>>    profile.delete_if { |v| v.empty? }
>>>    profile.each do |prof|
>>>      @manager.managements.build(:profile => prof, :company => @company)
>>>    end
>>>  end
>>>
>>> If the manager exists I only need to create a new management, so in
>>> the manager new action I've put:
>>>
>>> def new
>>>    @company = Company.find(params[:company_id])
>>>    @manager = Manager.find_or_initialize_by_fiscal_code(params[:fiscal_code])
>>>    respond_with(@manager)
>>> end
>>>
>>> If the manager does not exists I create a new one and a new management
>>> like showed before.
>>> But, if the manager exists the form action is to update manager.
>>> I'm searching for a solution to only create a new management without
>>> updating manager.
>>
>> Why can't you do what you want in the update action?  If the details
>> of the manager record have not changed then the update will do
>> nothing.
>
> Uhm it sounds strange to me creating a new management association in
> the manager update action.
> I mean update only to to update manger attributes.
> Perhaps I'm wrong.

If you want to do it in the manager controller then update is the
correct action as changing the managements that it has is effectively
an update, even though this does not involve editing the manager
record itself. The other alternative is to put it in the create
action of the management controller. It is up to you which seems most
appropriate.

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