[Rails] How can a gem (unintentionally) change the migrations path?

2016-04-13 Thread Andy Jeffries
I wrote a Gem (https://github.com/absolutedevops/civo) which is a simple Rails Engine containing a few API accessing models. However, when I include it in a Rails project, any generators create their files under the Gem's source code not the project's. I can't see anything I'm doing in the Gem

Re: [Rails] Application trace in the error page for a Rails engine

2014-07-07 Thread Andy Jeffries
Yes, Engines are considered part of the framework level rather than the application level. If I developed an engine and released it as a gem, you wouldn't want my lines littering your application stack trace, right? Cheers, Andy *Andy Jeffries* Ruby on Rails, RubyMotion, jQuery Developer

Re: [Rails] Difference between Cookies and Sessions

2014-07-07 Thread Andy Jeffries
requests have to come back to the same backend server. Hope this helps. Cheers, Andy *Andy Jeffries* Ruby on Rails, RubyMotion, jQuery Developer Taekwondo 6th Dan Instructor andyjeffries.co.uk +44 7939 164853 @andyjeffries http://twitter.com/andyjeffries fb.com/andyjeffries http://facebook.com

Re: [Rails] What is your style? Single quote, double quotes or depends?

2014-03-26 Thread Andy Jeffries
to be careful that one is seeing a real effect, which apparently you were, so that is all right. Doh, fair point, thanks for catching that :-) Cheers, Andy *Andy Jeffries* Ruby on Rails, RubyMotion, jQuery Developer Taekwondo 6th Dan Instructor andyjeffries.co.uk +44 7939 164853

Re: [Rails] What is your style? Single quote, double quotes or depends?

2014-03-25 Thread Andy Jeffries
On 17 March 2014 15:32, Colin Law clan...@gmail.com wrote: Did you try swapping the two lines round and checking that the result is consistent? Yes, it's consistent for me. Was it not for you or are you just asking? Cheers, Andy -- You received this message because you are subscribed to

Re: [Rails] What is your style? Single quote, double quotes or depends?

2014-03-17 Thread Andy Jeffries
According to a quick benchmark on my machine (MacBook Air 2013, Ruby 2.1.0p0), using double quotes is about 2% faster: require 'benchmark' n = 10_000_000 Benchmark.bm do |x| x.report { n.times do ; a = 1; end } x.report { n.times do ; a = '1'; end } end user

[Rails] Announcing: ActiveRestClient

2014-02-11 Thread Andy Jeffries
The company I'm currently contracting at has released their first piece of Open Source Software, a Ruby gem for interacting with REST servers. There are other gems out there but we wanted something that felt more like using ActiveRecord (like ActiveResource) but more customisable.

[Rails] Simple ActiveRecord serialise problem

2011-10-06 Thread Andy Jeffries
When I create a table with the following SQL: # create table foos (id SERIAL, content VARCHAR(255)); And define a class as follows: class Foo ActiveRecord::Base serialize :content, JSON end Creating a new instance of the class gives an error: f = Foo.new NoMethodError: undefined method

Re: [Rails] Re: Simple ActiveRecord serialise problem

2011-10-06 Thread Andy Jeffries
the second argument to serialise is used to say that you always want the serialised object to be of a certain class (e.g. Hash, an application specific class etc.). I'm not sure what you meant by passing JSON as that argument but I suspect that it isn't doing what you think it is. I was

Re: [Rails] Re: Simple ActiveRecord serialise problem

2011-10-06 Thread Andy Jeffries
I was basing it on this article (as well as a stack overflow answer) that you can provide a custom serializer in Rails 3.1: http://edgerails.info/articles/what-s-new-in-edge-rails/2011/03/09/custom-activerecord-attribute-serialization/index.html JSON provides a dump and load method on

Re: [Rails] Re: Simple ActiveRecord serialise problem

2011-10-06 Thread Andy Jeffries
I've also just tried upgrading JSON to 1.6.0 (as that's the version that seems to be installed if I do gem install json), same problem. Cheers, Andy -- 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

Re: [Rails] Admin interface for Rails?

2010-08-02 Thread Andy Jeffries
It's a generator, but it comes up with quite nice 37 Signals style admin interfaces. http://github.com/andyjeffries/andy_admin Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number

Re: [Rails] Rescuing Errors

2010-07-28 Thread Andy Jeffries
Hoptoad -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 28 July 2010 11:26, Pale Horse li...@ruby-forum.com wrote: Ideally, what I need is a method of rescuing ALL errors

Re: [Rails] Re: rails asset cache

2010-07-27 Thread Andy Jeffries
Sorry, no idea. (just to let you know that you're not being ignored it's just likely that no-one has an answer for you, this generally works fine for me). -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS

Re: [Rails] rails asset cache

2010-07-23 Thread Andy Jeffries
On 23 July 2010 10:52, Tom Mac li...@ruby-forum.com wrote: I have a of line code like %= stylesheet_link_tag styles,:cache = cache/styles % And it produces source as link href=/stylesheets/styles.css?1279620123 media=screen rel=stylesheet type=text/css /

Re: [Rails] Send picture from iPhone

2010-07-22 Thread Andy Jeffries
The rails output shows: [paperclip] An error was received while processing: #Paperclip::NotIdentifiedByImageMagickError: /var/folders/pD/ pDBak1ufEeSHluZ8kAougU+++TI/-Tmp-/stream20100721-4816-1pbpnnn-0 is not recognized by the 'identify' command. What is the best way to do this? The

Re: [Rails] starting with RoR

2010-07-22 Thread Andy Jeffries
Why is mySQL not the typical default DB? Because SQLite is easier to install/maintain on a developer's machine. It's easy enough to switch to MySQL when creating a project: rails my_project -d mysql I'm used to building up tables by hand...I'm aware there is a faster way of doing it in

Re: [Rails] Re: starting with RoR

2010-07-22 Thread Andy Jeffries
I wouldn't normally post silly little corrections/typos, but as the OP was a newbie (and might play with it, type the code in and fail to get it all to work): $ ./script generate scaffold User login:string password:string first_name:string last_name:string Should be: $ ./script/generate

Re: [Rails] Re: Ruby on Rails template designs

2010-07-19 Thread Andy Jeffries
Or as another example: http://github.com/andyjeffries/andy_admin :-) -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 18 July 2010 08:25, Abder-Rahman Ali li...@ruby-forum.com

Re: [Rails] Re: Re: Ruby on Rails template designs

2010-07-19 Thread Andy Jeffries
http://github.com/andyjeffries/andy_admin Thanks a lot. Does it give you the layouts to the pages? It generates the stylesheets and layouts, styles a lot of the standard classes and gives an amended form builder. Do you have an example of that? I've been meaning to put together a

Re: [Rails] :controller, how does Rails recognize them?

2010-07-19 Thread Andy Jeffries
It mentions that we have the following in the routes.rb file: map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' Now, in completing the tutorial, we will add the following to routes.rb: map.root :controller = home In the first two statements we have

Re: [Rails] Git on MAC OS X

2010-07-19 Thread Andy Jeffries
On 19 July 2010 15:46, Abder-Rahman Ali li...@ruby-forum.com wrote: I know that this question may not be here, but think that most of you using RoR deal with Git. I run a MAC OS X 10.5.8, and want to install Git running on my machine. But, I didn't find this version of my MAC OS X here: Hi,

Re: [Rails] Re: Does Nginx with Passenger actually work?

2010-07-19 Thread Andy Jeffries
Anyway, unless you are using your Mac as a server, why are you running Passenger on it in the first place? Mongrel is perfectly suitable for development. A lot of people: 1) Work on more than one site at a time (during a day) 2) Want it always available rather than having to remember to

Re: [Rails] Re: Git on MAC OS X

2010-07-19 Thread Andy Jeffries
On 19 July 2010 16:38, Abder-Rahman Ali li...@ruby-forum.com wrote: I now added /usr/local/bin to my path as follows: export PATH=$PATH:/usr/local/bin http://www.how-to-linux.com/2010/04/how-to-add-usrlocalbin-to-your-path-on-centos/ Good job. But, when I run now: brew install git I

Re: [Rails] how to do url rewriting

2010-07-16 Thread Andy Jeffries
posting the same question, phrased slightly differently without reading responses. Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 16 July 2010 11:53, Amit Jain li

Re: [Rails] Re: named_scope multiple conditions

2010-07-16 Thread Andy Jeffries
Thanks for the suggestion. However what did you mean specifically with your last comment? With anything like this any time you save when building up the conditions will be dwarfed by the time it takes to run the actual query Putting words in Frederick's mouth, but it simply means that

Re: [Rails] Re: how to do url rewriting

2010-07-16 Thread Andy Jeffries
What the purpose to hide the controller and action from URL? To have nicer URLs? For example: http://www.facebook.com/andyjeffriesrather than http://www.facebook.com/user/show/andyjeffries It's quite a common request. You can use the Apache mod_rewrite itself to make this change. You will

Re: [Rails] Ruby - return true if any element in Array satisfies condition but false otherwise

2010-07-16 Thread Andy Jeffries
On 16 July 2010 13:51, Michael Pavling pavl...@gmail.com wrote: On 16 July 2010 13:48, Ram yourstruly.vi...@gmail.com wrote: Anyone know a function that loops through an array and returns true if any one element satisfies the condition but false if none satisfy the condition? And it should

Re: [Rails] Effects of a humongous Controller on performance?

2010-07-16 Thread Andy Jeffries
My thinking is that perhaps every time a page is rendered, a mongrel has to instantiate this controller and that marshalling this into RAM is very time-consuming. Or does a controller get loaded into RAM at server startup and then the effect is not all that substantial for each page? Any

Re: [Rails] Re: Added associations but don't see generated methods

2010-07-16 Thread Andy Jeffries
what makes you think they aren't there ? I searched for them to no avail. Shouldn't they be in the Expense model (app\models\expense.rb); or Expense controller (app\controllers\expenses_controller.rb? No, they are dynamically defined and exist in memory only at runtime. Welcome to

Re: [Rails] Re: Added associations but don't see generated methods

2010-07-16 Thread Andy Jeffries
Welcome to dynamic objects and classes :-) Thanks. This restores my faith in Rails and enhances my appreciation of newsgroups, especially this one. Now I've got to put them to use! Good luck. Post back if you have any more problems. Cheers, Andy -- You received this message because

Re: [Rails] how can i hide controller and action name in url

2010-07-15 Thread Andy Jeffries
I am new in ROR. I want to hide controller and action name from url. exp. my current url: http://localhost:3000/triggers/index/amit123 expected: http://localhost:3000/amit123 remove controller(trigger) and action(index) name from url.

Re: [Rails] Is TDD really followed in the industry ?

2010-07-14 Thread Andy Jeffries
I am a rails beginners. I have created a couple of simple applications without following TDD. I have a question - Do good programmers really follow TDD strictly ? I mean.. Do they follow { 1. Write Test 2. Write Code 3. Refactor } cycle ? Is Writing tests before Implentation code

Re: [Rails] Kind of object

2010-07-09 Thread Andy Jeffries
$ irb class MyHash Hash ; end = nil h = MyHash.new = {} h.is_a? Hash = true Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 9 July 2010 08:52, Hemant

Re: [Rails] Re: Gentoo for Rails?

2010-07-09 Thread Andy Jeffries
On 9 July 2010 00:32, Gerardo Gonzalez Cruz gerardogc2...@gmail.com wrote: I Work rails on my beauty Gentoo System, i find hard install rails over Ubuntu because you need know each package to install :-(, on Gentoo is easy. Really? apt-get install ruby1.8 ruby1.8-dev rubygems gem update

Re: [Rails] [Rails3] Issue in modifying locale and redisplaying page

2010-07-09 Thread Andy Jeffries
On 8 July 2010 19:39, Erwin yves_duf...@mac.com wrote: In a test app, I have a drop-down selection to change the language of the site. I use an Ajax request to an action in which the locale is changed, and the it's redirected to the home page unfortunately, the locale seems to be changed but

Re: [Rails] Elegant Registration / Log in fix

2010-07-09 Thread Andy Jeffries
be a better way with Restful_authentication and you'll need to find out the param names you need to change the values for, but that may point you in a direction to get it working... Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64

Re: [Rails] Re: Gentoo for Rails?

2010-07-09 Thread Andy Jeffries
Please don't make it a flame war about linux distros. To the OP, I really haven't heard about any Gentoo user in the rails community so far, if I have to say there's a predminant OS in the rails community that would be Mac OS. (And I don't know why either) As a Mac OS X user I don't

Re: [Rails] on

2010-07-09 Thread Andy Jeffries
this his the generated code from my haml code form onchange=this.form.submit(); method=post action=/ switch_language?locale=fr select name=language[] id=language_option value=enAnglais/ option option selected=selected value=frFrançais/option option value=deAllemand/option/select /form

Re: [Rails] on

2010-07-09 Thread Andy Jeffries
Good catch Hassan -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post

Re: [Rails] Paypal Integration

2010-07-08 Thread Andy Jeffries
I'd recommend starting here... Episode 141: PayPal Basicshttp://railscasts.com/episodes/141-paypal-basics Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 8 July

Re: [Rails] Re: Re: How can I hide my Ruby code?

2010-07-07 Thread Andy Jeffries
We're developing the site but the day to day running is down the client (but they have lots of power from various sources, redundancy and sysadmins to type the password back in). Is the client trying to keep the code hidden from his own sysadmins or are you trying to hide it from the

Re: [Rails] Re: Re: Re: How can I hide my Ruby code?

2010-07-07 Thread Andy Jeffries
Or if there is any way so that I can encrypt my code without interrupting the execution of the application. If your client is determined to access your code even an encryption of the Ruby source code will not be sufficient. In order for MRI to interpret Ruby it must be decrypted. If the

Re: [Rails] Re: How can I hide my Ruby code?

2010-07-07 Thread Andy Jeffries
Interesting solution, but also not secure. Anybody who has root can read out your running processes' memory spaces and either (a) grab the key and yer pwned or (b) grab the bytecodes, decompile and yer pwned. Yep. Completely agree. They weren't planning on stopping crackers, but sysadmins

Re: [Rails] Re: How can I hide my Ruby code?

2010-07-07 Thread Andy Jeffries
On 7 July 2010 01:25, Skip Levens s...@getactivestorage.com wrote: Props to Andy's solution - thats pretty awesome... hopefully not everyone needs that! Thanks Skip and I agree with your hope. There are so many weird things I've done on this project, it's been a great/interesting

Re: [Rails] Re: Re: How can I hide my Ruby code?

2010-07-06 Thread Andy Jeffries
On 6 July 2010 10:34, Sumanta Das li...@ruby-forum.com wrote: Or if there is any way so that I can encrypt my code without interrupting the execution of the application. You can do this (I've had to do it for a client) but it's not simple and I can't share my solution's code. However, you

Re: [Rails] Re: Re: How can I hide my Ruby code?

2010-07-06 Thread Andy Jeffries
On 6 July 2010 11:31, Michael Pavling pavl...@gmail.com wrote: On 6 July 2010 11:19, Andy Jeffries a...@andyjeffries.co.uk wrote: You can do this (I've had to do it for a client) but it's not simple snip super secret process Very interesting approach. Will file that for future reference

Re: [Rails] problem finding find current page

2010-06-29 Thread Andy Jeffries
On 29 June 2010 11:00, Neil Bye li...@ruby-forum.com wrote: I have this bit of code in my email.controller user = @current_user story = @current_story recipient = story.user It doesn't work because @current_story isn't defined. How can I find the current page to make this work? You

Re: [Rails] (JOBS) Junior Rails Developer, London, UK

2010-06-28 Thread Andy Jeffries
We're actually looking for currently UK located developers. Thanks anyway, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 26 June 2010 08:21, ratnamraj varasala chinnuj

[Rails] (JOBS) Junior Rails Developer, London, UK

2010-06-25 Thread Andy Jeffries
The company I'm contracting at is looking for: An enthusiastic, junior Ruby on Rails developer. Maybe you've been using PHP for a few years and have recently started playing with Rails or you've been using Rails for a while but only in a small/sideline capacity and want to move up to using it in

Re: [Rails] Re: Mac and Rails

2010-06-18 Thread Andy Jeffries
Use Apache locally too. It's simple, Apache is already installed on Snow Leopard. Install Passenger and configure it (which you'll need to learn how to do for production anyway). What a waste of effort IMHO. I've never used anything but Mongrel locally. It works fine n What

Re: [Rails] Need Help - New to RoR

2010-06-17 Thread Andy Jeffries
Look in your log file (your_app/log/*.log) - the error will be detailed in there. Also, it seems from the error message you're running in production mode, you should really switch to development then you'd see the full error message in your browser. Cheers, Andy -- Andy Jeffries http

Re: [Rails] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Andy Jeffries
These values are then converted to seconds and stored as decimal in the DB (I allow fractions of a second, too (tenth, hundredth, millisecond). when they are retrieved form the DB, I convert the seconds to a string format of, for example, 01:39:11 (from 5951 seconds). If fractions are used,

Re: [Rails] Off Topic Advice Needed (Time objects)

2010-06-16 Thread Andy Jeffries
If you have two floating point values representing seconds (and parts of) why can't you just compare the two floating point values? What part are you stuck with? Can you give us some code with a comment on which bit you can't do. I don't have a problem with comparing floats, but I might

Re: [Rails] Mac and Rails

2010-06-15 Thread Andy Jeffries
I have been just tasked to learn Rails for a new project and have been given Mac machine for it. I have never used a Mac / Linux ever. I have used Rails before on Windows. I need to set up Rails development env on this Mac machine. Its Mac OS X - Snow Leopard. The development environment

Re: [Rails] Compress css files with Rails

2010-06-04 Thread Andy Jeffries
stylesheet_link_tag with the :cache option. Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 4 June 2010 09:37, Gregory Ma li...@ruby-forum.com wrote: Hi, I

Re: [Rails] Compress css files with Rails

2010-06-04 Thread Andy Jeffries
See the :cache = true option of stylesheet_link_tag http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#M002231 You don't have to use true either - you can use a string (so if you have more than one layout each using a different set of stylesheets you can create

Re: [Rails] How to specify which database we're using?

2010-06-04 Thread Andy Jeffries
rake db:seed RAILS_ENV=test -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 4 June 2010 15:31, Ramos wonder.ra...@gmail.com wrote: I am seeding my environment for testing

Re: [Rails] Re: Ruby on Rails + Flash Application ?

2010-06-03 Thread Andy Jeffries
and if you ask a boss or customer what is that they prefer, pretty vs. working code, I can tell you that not 100 but 200% of them will choose working. ;) I don't give my clients that choice. They get properly designed code that works. It's not up to the client to make technical

Re: [Rails] how to float layouts/partials so that they stay in a static position in the browser?

2010-06-03 Thread Andy Jeffries
http://tinyurl.com/253tgp8 (hint to Ivan, use http://lmgtfy.com/ - it's great for links like this :-) ) -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 3 June 2010 14:00, Ivan

Re: [Rails] Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
yep u can index.js.erb and in it, render your response buts its worse idea, return json, and build dom I'm not sure to understand. You think it's better to return json and than build the dom from the javascript? It's faster/lighter to do it that way. However, you often break

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
It's faster/lighter to do it that way. However, you often break DRY* as you have two sets of logic used to create markup from a dataset (one in Rails and one is JS). So I'm not sure I agree with Ivan. If you don't agree how would you do it? I'd do it as the OP requested, have a

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
I'd do it as the OP requested, have a partial used in both places and return that. Sorry, just realised you were the OP :-) In particular I'd use jQuery's load method to load the URL in to an element (the original page's container for this section): http://api.jquery.com/load/ And from

Re: [Rails] Re: Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
This is exactly what I planned to do until you said it would be better to return json Ivan said it would be better, not me :-) I said that it is faster/lighter weight - but not better and said I disagreed with him. Cheers, Andy -- You received this message because you are subscribed to

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
mm, u can do it but 1) u should write yet anothe action at controller, its not like REST No reason why you should... def show ...blah...blah...blah if request.xhr? render :partial = whatever end end 2) its will be more slower, than render at mobile device, from json How

Re: [Rails] Virtual/Flexible attributes on model

2010-06-03 Thread Andy Jeffries
On 3 June 2010 15:06, Michael Pavling pavl...@gmail.com wrote: I've a requirement to put some user-managed attributes on a model. Essentially, I want Entity-Attribute-Value functionality - the administrator has the ability to create fields on the model, and to specify their type (datetime,

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
On 3 June 2010 15:17, Ivan Nastyukhin dieinz...@me.com wrote: if request.xhr? render :partial = whatever end if developers, from my team, write this, i curse too much for such) If a developer from my team makes a judgement/technical direction based on incomplete facts I'd curse

Re: [Rails] Virtual/Flexible attributes on model

2010-06-03 Thread Andy Jeffries
class UserAccount ActiveRecord::Base serialize :meta_data, Hash end That would get it working to demo, but I *know* that they're going to want to search/filter on the attributes once they have their hands on them, so I'd prefer to start with a DB record per attribute that gets

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
Out of interest, what's your problem with the above code? its crutch, for incomprehensible thing Sorry, I don't understand - could you rephrase... Premature optimisation is the root of all evil... yep, but i'm thinking, that write 1-10 LOC in js, witch will be build partial for each

Re: [Rails] Re: Re: Return partial from a xhr request

2010-06-03 Thread Andy Jeffries
Out of interest, what's your problem with the above code? its crutch, for incomprehensible thing Sorry, I don't understand - could you rephrase... U should not insert if request.xhr? u can create view, with build js ( show.js.erb) and in its view call render, but with js escape Fair

Re: [Rails] cookie has key/value pairs and lost order after JSON decode

2010-05-28 Thread Andy Jeffries
 ActiveSupport::JSON.decode(cookies['item_list']) and the result is actually in a hash, then the ordering is lost... Is it true that if the original JSON object has an array of hashes (1 key and 1 value), then the order can be preserved? But what if the original JSON object was a hash of

Re: [Rails] Re: One Array - 3 Columns of Equal Length

2010-05-28 Thread Andy Jeffries
http://weblog.rubyonrails.org/2006/3/1/new-in-rails-enumerable-group_by-and-array-in_groups_of enjoy! This isn't quite the same thing though. a = %w(1 2 3 4 5 6 7 8 9 10) a.in_groups_of(3) = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, nil, nil]] It gives you 4 groups, not three as the OP's

Re: [Rails] URGENT + production migrations

2010-05-27 Thread Andy Jeffries
I am in a great need of you people. My migrations are not running on production database. I done some changes in production mode and then i ran rake db:migrate RAILS_ENV=production / RAILS_ENV=production. But my database is not reflecting. Can you people tell me that what are the possible

Re: [Rails] Re: URGENT + production migrations

2010-05-27 Thread Andy Jeffries
Did you create new migrations or edit existing ones? I edited migrations on my local machine and checked in them.. :) Just now i realised that this could be the problem of me. It is indeed :-) Ok tell me one thing, if i edit a already migration file, and run rake db:migrate then would that

Re: [Rails] Re: Re: URGENT + production migrations

2010-05-27 Thread Andy Jeffries
I edited migrations on my local machine and checked in them.. :) Just now i realised that this could be the problem of me. It is indeed :-) Resolved it. Thanks to all of you with a big smile .. :) :) Happy to help. Good luck, Cheers, Andy -- You received this message because you are

Re: [Rails] Re: URGENT + production migrations

2010-05-27 Thread Andy Jeffries
On 27 May 2010 15:15, anon_comp neocools...@gmail.com wrote: I know this has already been resloved, but instead of creating a new migration, you could have gone back to version 0 rake db:migrate VERSION=0 then run rake db:migrate this should update all migrations you edited. The downside

Re: [Rails] Is using script/console in live production environment ok?

2010-05-27 Thread Andy Jeffries
On 27 May 2010 15:45, james hindle.ja...@gmail.com wrote: I need to make some minor record changes in the database on my live production site. I use Capistrano to deploy. I know I can activate script/console by entering my /current Capistrano directory and running: RAILS_ENV=production

Re: [Rails] Private methods in rails

2010-05-24 Thread Andy Jeffries
What would happened if you never use private methods? Will it be some security issue (and if yes, I'd like to see an example if it is possible) OK, here's a quick example. Assuming you have the default routing rules in place so it handles /:controller/:action class LoginsController

Re: [Rails] Performance Issue

2010-05-06 Thread Andy Jeffries
@licences = Licence.scoped_by_user_id(10) usedpermlicence = @licences.scoped_by_status_and_licence_type(1, 0) usedtemplicence = @licences.scoped_by_status_and_licence_type(1, 1) remainlicence = @licences.scoped_by_status_and_licence_type(0, 0) remaintemplicence =

Re: [Rails] Rails database performance issue

2010-04-29 Thread Andy Jeffries
a million rows, then actually test/benchmark your app. Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 29 April 2010 09:13, TechSlam aslam9...@gmail.com wrote

Re: [Rails] exiting the function

2010-04-27 Thread Andy Jeffries
Mohammed, you can write the above as follows: @property.destroy if IsAuthorized?(@property.user_id) Well, you could, *if* IsAuthorized? -- which idiomatically should be is_authorized? -- returned a boolean value :-) Personally I'd prefer authorized? - I never use is_...?, the is_ is just

Re: [Rails] Sessions

2010-04-27 Thread Andy Jeffries
in my application, i have login form. while login into the application iam maintaning the details in session. i want to remove the stale sessions and while removing the stale sessions i want to perform some operattions on database . how to do this. How are the sessions stored? The default

Re: [Rails] Anyone else notice that http://api.rubyonrails.org has been hijacked?

2010-04-21 Thread Andy Jeffries
Yes. Yesterday called, they want their news back... http://twitter.com/#search?q=rubyonrails.org -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 21 April 2010 10:09, Amala

Re: [Rails] Rails 3 Phusion Passenger - Ruby (Rack) application could not be started

2010-04-20 Thread Andy Jeffries
There's normally an actual error above that, you've posted the stack trace (which is useful after you know what the error is). Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number

[Rails] Master table without related child record

2010-04-20 Thread Andy Jeffries
in my head today. Any ideas? Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 -- You received this message because you are subscribed to the Google Groups Ruby

Re: [Rails] Master table without related child record

2010-04-20 Thread Andy Jeffries
Having a bit of a braindead day, can anyone help with this. I have three models: Player, Game, Prediction (Player has_many :games, :through = :prediction) I want a named_scope that finds games that the current player hasn't already predicted. How about tackling it from the Player

Re: [Rails] Drupal like cms

2010-04-19 Thread Andy Jeffries
On 19 April 2010 10:25, Amala Singh amalasi...@gmail.com wrote: If it takes one year to develop a CMS in rails then is that rubbish that have tutorials that claim develop a blog in 15 minutes? It would take less than a year to develop a CMS for a client (I've done it a NUMBER of times), but

Re: [Rails] Caching with Rails

2010-04-19 Thread Andy Jeffries
I've been reading the Rails Guide about caching and I have a few questions about it. I've read that it is not possible to cache a page with url parameters, for instance 'http://.../com/products/category_id=5'. Am I correct? Isn't there any way to be able to do so? You can do it, but it

Re: [Rails] Re: Caching with Rails

2010-04-19 Thread Andy Jeffries
http://www.example.com/products/category/5 Then it would work - the 5 would become 5.html in a folder called category in a folder called products. Thank you Andy for you explanation. How do you do to make your urls look like this? config/routes.rb map.category

Re: [Rails] Drupal like cms

2010-04-19 Thread Andy Jeffries
Thanks for your views. I wonder why this is not taking up. I know drupal is stealth. But with handy rails in hand, if we start now, in a year we could make not only drupal, a double or triple that of a drupal. Because I believe that drupal with PHP, not that easy to make upgrades

Re: [Rails] Re: asking for tools

2010-04-16 Thread Andy Jeffries
Along with Bundler which now puts all gems directly in to your project (there is a blog post somewhere on using Bundler with Rails 2.3...) Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS

Re: [Rails] all about Ruby on Rails

2010-04-15 Thread Andy Jeffries
i am very very interested on Ruby on Rails technology presently i am working as SEO and Web analytic and now i want to learn all about Ruby on Rails so please help me for it I'd recommend this site : http://tinyurl.com/cvh574 Good luck, Andy -- You received this

Re: [Rails] asking for tools

2010-04-15 Thread Andy Jeffries
I have searched for a development sandbox tool, like virtualenv or buildout in python. But I didn't have results. Please, Any suggestion? What do you mean? Running 'rails sitename' will create you a website. From the resulting sitename folder you can do script/console to run an interactive

Re: [Rails] Re: Model Magic

2010-04-15 Thread Andy Jeffries
Yes, I know about this AR behavior. I think, would be correct if the comparison works both ways. For beginners, it looks like a bug. Is it really worth monkeypatching Array#eql? for this? I think not. I almost posted the same thing earlier, but had a second thought. Would it not be

Re: [Rails] module/class question

2010-04-14 Thread Andy Jeffries
On 14 April 2010 01:45, Me chabg...@gmail.com wrote: Are these two below the same thing? 1. module X module Y class Z 2. class X::Y::Z Providing class Z has already been created with style 1, yes. If you try to run style 2 without X and Y having been created you will

Re: [Rails] question about named route

2010-04-14 Thread Andy Jeffries
I defined the following in routes.rb to use ':title' instead of ':id'. map.movie '/ movies/:title', :controller='movies', :action='show', :conditions={:method=:get} This seems to work fine, but 'movie_path()' still uses ':id' instead of ':title'. movie = Movie.get(parms[:id]) p

Re: [Rails] question about named route

2010-04-14 Thread Andy Jeffries
On 14 April 2010 09:29, bala kishore pulicherla balumc...@gmail.com wrote: you can use http://svn.techno-weenie.net/projects/plugins/permalink_fu/plugin I think you're solving a different problem than he asked for though. Permalink_fu is good for creating slugs, so if he had Throw Momma From

Re: [Rails] Model question

2010-04-14 Thread Andy Jeffries
But how to return records with no Orders ? I'm thinking that I may need something along the lines of: But that seems ugly. Any suggestions for neater ways? How about using counter caches - something like: class Order ActiveRecord::Base belongs_to :customer, :counter_cache = true end

Re: [Rails] order by variable field name

2010-04-14 Thread Andy Jeffries
On 14 April 2010 12:29, ashu rajeevsharm...@gmail.com wrote: What i have snip What i need when user Click On Age or name or sex records should be in that order as user clicked.if user clicked on age Twice Then record should reverse . that would be bonus . By

Re: [Rails] confirm b4 submit?

2010-04-14 Thread Andy Jeffries
On 14 April 2010 02:57, David Zhu dzwestwindso...@gmail.com wrote: Before a user submits a form can I redirect them to a confirmation page with all their fields on it, and then finally, there is a final submit button that saves it to the database? Tanks You could code this, yes. You'd want

  1   2   >