|
rca: but you can install a firefox add-on that makes them delicious delicacies again
rca: yes, the cookie's just a cookie AFAIK
Oleander: ok thaks
rca: i'd have to peek at some rails wiki page to make sure
rca: no prob though, hope i wasn't lying :)
rca: some people claim using the db as a session store is wonderful and makes bald men grow hair again
zimnyx: I'm running rails 2.0.2 and met error "stack level too deep", which I cannot fix - I guess it's not caused by explicit bug in my code.
zimnyx: Any of you met this situation?
leethal: zimnyx: can you paste the code that raises this error?
leethal: stack level to deep means that you have an infinite recursive thingie
rca: leethal: hey ho! i forgot to watch NRK today
blj: Oleander: using session as cookie store is becoming hot as it removes a lot of headache.
langenberg: Anyone using nginx to serve static (page cached) files?
leethal: langenberg: ya
langenberg: leethal: Noticed a problem when you're doing a POST instead of a GET?
leethal: nope
leethal: also, I rarely do POST 'instead of' GET =P
leethal: i do POST when I need to POST, and GET when I need to GET!
langenberg: leethal: Like 'POST /pages', will search for a /pages.html and then give a 405 not allowed, since it ofcourse doesn't allow the POST method on the /pages.html file.
leethal: right
leethal: why are you caching pages that's related to POST requests anyway?
defswork: sounds like bad setup - shouldn't that not go to rails ?
langenberg: I'm not
zimnyx: leethal: my co worker told me that the cause may be the bug in classloader.
langenberg: I'll post my config
J2RoR: How can I test my form on the view level as opposed from the models.
Oleander: blj: thanks
langenberg: leethal: http://pastie.caboo.se/148145
leethal: J2RoR: testing a form?
J2RoR: leethal: a registration form
langenberg: I'm trying to figure out how to place an extra conditional here.
leethal: langenberg: extra condition for what?
langenberg: Like: if($request_method == 'GET')
leethal: langenberg: what exactly is your problem?
leethal: you can't do post requests at all?
J2RoR: leethal: I am trying to make it fail/pass a registration form .. . but I want to do it on the view.
snailrails: is there a way to capture the validation errors in the controller and render different actions depending..
Klian: How can I create a extension for a plugin ? I want to add this: http://deadprogrammersociety.blogspot.com/2008/01/making-s3-folders-in-ruby.html to the aws3 plugin
zimnyx: leethal: I forgot to mention that stack level too deep never occours on 1st page load, every next request to the same page causes this error.
langenberg: leethal: If I POST to a path, which also exists on the filesystem, nginx will break and not ever hit rails.
TTilus: [[thufir]]: that graceful handling, just that user doesn't get exceptions on her face if she should enter malformed data or a save should fail and in the later case the system would log or at least alert user about what particular saves failed
leethal: langenberg: why are you posting to a file that exists on the filesystem?
langenberg: leethal: POST /pages/4, has the same path as GET /pages/4.
leethal: still, why are you posting to it?
TTilus: [[thufir]]: usecase, you import something an get an explosion, how do you know what the state of the system is, what got in and what did not?
J2RoR: leethal : any suggestion ?
leethal: J2RoR: no idea what you're trying to do
langenberg: leethal: Because I want to update the page with id 4 ofcourse
leethal: so what happens if the update fails? how do you show an error message?
leethal: langenberg: also, I can understand that =P
langenberg: leethal: great ;)
leethal: langenberg: I'm (as always) asking from a user's point of view
leethal: why do a user post to /pages/4?
langenberg: Because a user wants to update the page.
langenberg: It's that simple.
leethal: admin/pages/4 ftw
manopulus: hello. sorry for stupid quesion. i have to build small app - which waits for XML http push fro server (i building clinent), parses that received XML and put to DB, if all ok, returning a value by http. where i can look for examples. i am not stong with ruby, but do not know nothing about xml
langenberg: Nah, basich HTTP auth. ftw
leethal: langenberg: admin/pages/4 f tw
leethal: it's a different resource imo
blj: POST /pages/4 perfect
leethal: an admin resource and the public cached resource
blj: admin/pages/4 is hack
J2RoR: leethal: I am actually trying to render when incorrect data is entered
leethal: sigh, spend 1 minute making admin/pages/4 work, or spend 1 hour trying to work around page caching mechanics so that you can post to pages/4
leethal: your call
langenberg: Okay, so on a GET to /pages/4, rails generates a '/pages/4.html' right? Now on a POST to /pages/4, nginx sees a file on the filesystem named '/pages/4.html', so it doesn't hit rails anymore!
blj: POST /pages/4 is the right thing to do and once and for all find out why nginx is complaining
langenberg: blj: It just need to tell nginx it only needs to try to serve something from the filesystem on a GET request.
blj: langenberg: nginx sure can check the http method cant it?
langenberg: blj: Yeah, I just need to figure out how I can do some simple conditioning.
leethal: sigh
langenberg: $request_method is the variable.
leethal: ugly workarounds sucks
leethal: if ($request_method!=GET) { .... }
blj: leethal: this is not a workaround, this is the correct way to do it.
blj: admin/posts/4 is the workaround
leethal: blj: are you god? you seem to be very confident.
leethal: I'm however very confident that a static, unauthenticated view and an admin updating things are different resources
leethal: I'm not god, though =/
blj: leethal: you seem to have taken my earlier joke too seriously... sorry if i had offended you in any way
langenberg: Well the resource is '/pages/4', it can respond to a GET, PUT and DELETE method. The GET method should be cached.
blj: is never confident, but likes the fact that langenberg is trying to be REST, so trying to help.
langenberg: :D
leethal: blj: thank you, I was almost crying
langenberg: if ($request_method == GET) { ... } doesn't work btw
blj: != is what leethal said
leethal: nginx isn't using double equals, does it?
langenberg: Ah
darkblade747: hi guys
leethal: what a sentence kek
leethal: scentence?
leethal: rawr
darkblade747: having a migration issue....it fails and says that my clients table already exists
darkblade747: i then added a drop_table :clients before my create_table in self up
darkblade747: no dice
blj: darkblade747: :force=>true or something
blj: darkblade747: but why are you creating a table that already exists ?
langenberg: '"if" directive is not allowed here '
blj: darkblade747: you should not be in that situation
langenberg: really strange
darkblade747: blj: i was just copying one of the tutorials i came across and they added create table
langenberg: Does it support nested conditions?
darkblade747: http://www.pastie.org/148150
blj: langenberg: whats your latest config like?
blj: update pastie
darkblade747: blj: my yaml?
langenberg: if ((-f $request_filename) && ($request_method != GET)) { break; }
darkblade747: or were
darkblade747: ?
Klian: How can I create a extension for a plugin ? I want to add this: http://deadprogrammersociety.blogspot.com/2008/01/making-s3-folders-in-ruby.html to the aws3 plugin
langenberg: invalid condition "-f"
leethal: langenberg: heh just split it up in two
leethal: copy paste some other condition thingie
darkblade747: http://www.pastie.org/148151
leethal: Klian: what is a 'extension for a plugin'?
langenberg: leethal: if (-f $request_filename) { break; }
Klian: leethal: An optimization for a plugin. I need to add two new methods
blj: darkblade747: http://www.pastie.org/148153
leethal: langenberg: the nginx docs ftw
leethal: Klian: just edit the plugin I guess
langenberg: leethal: took me some time to find them
langenberg: leethal: http://wiki.codemongers.com/NginxHttpRewriteModule#if FYI
leethal: winwinwin: failfailfail!
darkblade747: blj: no dice
leethal: langenberg: so, if($whatever_it_was ~ "GET") { .. } then?
leethal: noes, you have a sample there
leethal: if ($request_method = POST ) { ... }
blj: langenberg: if ($request_method = POST ) { proxy_pass http://mongrel; break; }
langenberg: They can't be nested :(
leethal: perhaps statements can
blj: langenberg: you dont need them to be nested
leethal: then again, DRY isn't always necessary
blj: langenberg: just put it as the first thing
langenberg: Then I've got two proxy_pass statements
darkblade747: blj: is there a way to do migrations completely taking that "create table" portion out
darkblade747: like just....adding the new fields
blj: langenberg: so what?
langenberg: Flow is as following: if method is anything else then GET, hit rails. Else try to lookup the file on the filesystem. If that doesn't work out, still hit rails.
langenberg: nothing :P
winwinwin: leethal loseloselose
blj: darkblade747: just comment the create_table block.
leethal: winwinwin: nonono
darkblade747: blj: but then it won't know which table to update
blj: does attachment_fu has any callback hook like after_resize etc.
blj: darkblade747: migrations take the version cue from schema_info table, you can manipulate the db by hand, if you had screwed up.
leethal: blj: yep
leethal: after_resize, after_attachment_saved and before_thumbnail_saved
blj: leethal: i want to add extra processing with rmagick.
leethal: blj: it's all in http://svn.techno-weenie.net/projects/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb =)
blj: leethal: oh great
blj: leethal: thanks
leethal: starts on line 119
brkn: hi, anyone confident with backgroundrb?
blj: leethal: great, the after_resize do |record, img| , i presum the img i the rmagick object i suppose.
blj: leethal: anyway will take it from here, thanks for pointer
leethal: blj: I really had no idea, I just ran some finds on the source code =)
brkn: I keep getting 'not able to connect' when trying to start a worker from a rails action, but I feel like I'm missing something I cant grasp from the doc
brkn: (that I've read up'n'down)
blj: leethal: ah, i was too lazy :)
leethal: that's what I love the most about open source - you don't need docs to find out these kinds of things
darkblade747: blj: ok thanks
snailrails: how do i handle current_user is rpsec controller ?
jason_au: Is there an easy way to force singluar restful resource routing to map to a *singular* controller name?
fbjork: how do I set the default url on my site to be http://www.domain.com/en instead of http://www.domain.com/en/index ? i currently have this route in place: map.connect ':locale/', :controller => 'index'
[[thufir]]: TTilus: thanks. (sorry for the delay, was afk)
Jellybob: fbjork: You need to set :action => 'index' as well
[[thufir]]: has anybody had success with importing by "source foo.sql"? it fails with a syntax error for me: http://pastie.caboo.se/148137
blj: jason_au: :controller=>'whatver'
snailrails: if i get undefined local variable "current_user" How would i create a mock object for that ? its not seeming to work
langenberg: Thanks blj and leethal. Nginx is behaving well now. :)
Jellybob: snailrails: Are you using a mocking framework?
blj: langenberg: glad it worked, blog it
snailrails: rspec
langenberg: Yeah I'll blj
Jellybob: I think it's something like current_user.returns User.new(attributes)
Jellybob: snailrails: Check the Mocha API docs for the details though
jason_au: blj: even with map.resource :blah ?
blj: jason_au: or change your controller name to plural
blj: [[thufir]]: what is source command ?
jason_au: blj: actually, just tested it, it works.. thanks
saizai: quick question: what's the word for linking two models so that if foo has_many bar, deleting foo deletes the bars? I can't remember what it is and can't find it in the API :-(
[[thufir]]: blj: it's on page 39 of "ruby on rails; up and running" (oreilly), and is used to, apparently, import data to a db.
Arsen7: saizai: :dependent => ...
blj: [[thufir]]: i have no idea what it is though, but source command looks like tcl interpreter.
saizai: Arsen7, thanks!
[[thufir]]: what's a good way to get data into the db? a bunch of SQL? stick it in the migration?
blj: saizai: in has_many options look for :dependent=>:destroy
blj: [[thufir]]: yaml ftw!
Jellybob: [[thufir]]: I usually create a Rake task which uses ActiveRecord to create the data
[[thufir]]: Jellybob: can you give an example, or point me in the direction for that?
blj: [[thufir]]: if you are in migration you dont need sql, you can insert data directly using model class
[[thufir]]: blj: yeh, I think that I'm going to do that for now, but I may need to import data down the road from CSV sources.
blj: [[thufir]]: put the yaml files, similar to your test fixtures and create a model class within migration and import the yaml
saizai: blj, found it. exactly what I wanted, thanks
J2RoR: leethal: would it be possible to flash a message from a test
J2RoR: like : flash['message'] = "That movie has been burned."
J2RoR: which is not asocieted with a controller ?
Jellybob: J2RoR: What do you mean by not associated with a controller
J2RoR: flash[:message] . . It will return the message from the controller
Jellybob: J2RoR: It will return the :message element in the flash - so long as it's there, it doesn't matter which controller you're using
J2RoR: well i am carying out a test . . .and I want to be able to display a message
J2RoR: e.g. you have been redirected
Jellybob: J2RoR: I just use "assert_not_nil flash[:message]" in my tests
Jellybob: Which is why I'm confused - it works just like it does when running the app
J2RoR: Jellybob: the message symbol does it contain string ?
raggi: with the resources system, what is the simplest way to allow /user/:name aswell as /user/:id, and is this sane (to want to allow both)? (other than the obvious potential for clobber ofc)
Jellybob: J2RoR: It shouldn't matter what it contains - it's just a hash
J2RoR: well I get an error when I test it
Jellybob: can't be bothered to guess what that error might be
Jellybob: How about you give me a clue
[[thufir]]: why does this rake command not drop the table from the db? http://pastie.caboo.se/148167
pitchblack: ahoy
J2RoR: Jellybob: I added a string value and it passed
Jellybob: J2RoR: Wow... so you mean assert_not_nil asserted that it wasn't nil then?
J2RoR: assert_not_nil flash[:message] = "The record couldnt be found."
dgod: man, nested resources and scaffolds are messy
J2RoR: Jellybob: I think it was nil.
Jellybob: J2RoR: You've just overridden the value in your test
Jellybob: J2RoR: So all your testing now is that your test works - not that the code *being tested* work
swombat: hello punters
swombat: #<RuntimeError: no bj found in ["/var/www/Woobius-edge/releases/20080206104224/script", "/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/usr/X11R6/bin"] << how do I add anoher directory to the list of folders where Rails looks?
pitchblack: LOAD_PATHS << ?
swombat: pitchblack: thankee
J2RoR: Jellybob: when I leave the string out it fails. how can I remedy this problem ?
brkn: is there any equiv. of request.env['SERVER_NAME'] that doesn't involve requests?
swombat: hmmm...
swombat: LOAD_PATHS << "/var/lib/gems/1.8/bin/"
swombat: is causing my server not to even start up now
swombat: (I put it in config/environments/production.rb)
keeran: should i be able to eval(somestring) within a block, something like this:
lifo: you're just getting a bad bj
swombat: lifo: teeth r teh evil
keeran: or do i need to eval that to a proc or something
lifo: :P
swombat: lifo: any idea why it blows up?
lifo: man...i have to go buy coffee :(
keeran: lifo: 'bad' ? :)
swombat: oh noes
lifo: keeran: yeah..poor swombat ;)
lifo: swombat: $LOAD_PATHS ?
swombat: cheers
lifo: with $
lifo: lol
swombat: wtf happened there
lifo: you became a vampire
swombat: oh sweet
swombat: so my strength and dexterity must be way up now
lifo: lol..wait..lemme get a wooden stick
swombat: hrm, server still dies
swombat: $LOAD_PATHS << "/var/lib/gems/1.8/bin/"
lifo: whats the error
swombat: no error
swombat: it tells me nothing
swombat: server just never comes up
swombat: ah wait, prolly an error in the mongrel logs
swombat: heh
swombat: undefined method `<<' for nil:NilClass (NoMethodError)
swombat: I get the impression LOAD_PATH is for libraries anyway, no?
swombat: I need "execute_path" or something
lifo: i need a smoke!
Jellybob: J2RoR: You remedy the problem by fixing the code that should be setting flash[:message]
Jellybob: J2RoR: It's perfectly normal for a test not to pass - that's how you know when your code is broken
lifo: swombat: $LOAD_PATH << "/var/lib/gems/1.8/bin/"
lifo: without "s"
Oleander: could someone help a confused newby: having trouble grasping the diff between a session and cookie and a session cookie
swombat: lifo: oh
Jellybob: Oleander: A cookie will stick around until you've told it to expire
Jellybob: Oleander: And a session cookie will be deleted when the browser is closed
Jellybob: Oleander: *The* session is a way of tracking data for a user, and uses a session cookie to track that
Oleander: Jellybob: ahhh ok
Oleander: Jellybob: how does the session know the user has closed thier browser?
thuglife: hi
Jellybob: Oleander: The browser automatically deletes any session cookies on close - there's no need to worry about the details of how that works, because it's the problem of browser developers
Oleander: Jellybob: ok
Oleander: Jellybob: thanks
thuglife: I have a stupid question. I've two scaffolds one named foo the other named bar
thuglife: from the bar index.html.erb i'd like to list something from the other scaffold
Jellybob: Oleander: http://feeds.feedburner.com/~r/seomoz/~3/228797354/controlling-search-engine-access-with-cookies-session-ids
Oleander: Jellybob: thanx
Jellybob: It's targetted at SEOs, but I'll let it off for being a good (if simple) description
thuglife: so in foo_controller.rb i do @list = Foo.find(:all)
brainopia: Is there a rake command to run migrations in development and test environments?
Jellybob: thuglife: Set a different variable for the other stuff
thuglife: and in the erb file i do <td><%= list.name %></td>
thuglife: and that generates: undefined method `generated_methods' for "IN":String
[[thufir]]: in my migration, http://goodfellow-tool.googlecode.com/svn/trunk/db/migrate/001_calls.rb, there's a datetime field (label). in the migration, how do I enter a date?
thuglife: Jellybob: the name does not matter
thuglife: i've tried many
Jellybob: thuglife: Can you pastie your code
thuglife: Jellybob: sure
thuglife: Jellybob: http://pastebin.ca/893716
solar_ant: Hi all
solar_ant: I have a mail field which I am showing this way
solar_ant: <%= f.text_area :body %>
solar_ant: how can I quote the entire content ?
Jellybob: thuglife: That's a bit odd... just to be sure do you have a name column in the database?
thuglife: yes.
thuglife: id | name | domain | qtype | class | rdata
thuglife: ----+------+-------------+-------+-------+---------------
thuglife: 1 | www | ojjektum.hu | A | IN | 213.163.8.130
thuglife: i've tried other colums too but i get the same error
thuglife: @records gets passed correctly
thuglife: since i see 3 entries
thuglife: and i have 3 records in the database
giorgian: hi. i installed acts_as_ferret via gem_install and also via script/plugin install. now, script/server works, but script/console cannot find it. before i begin messing up the scripts, is there a clean solution to make script/console use the same paths of script/server?
[[thufir]]: for this migration: http://goodfellow-tool.googlecode.com/svn/trunk/db/migrate/001_calls.rb , how would I have the model, http://goodfellow-tool.googlecode.com/svn/trunk/db/migrate/001_calls.rb , calculate the duration field? duration => :start - :end ?
thesaint4444: hi guys, can anyone tell me what is wrong with this controller - http://pastie.caboo.se/148179 I have a form that passes in the data, I try to access the params hash and pass the values to a method (def kcxor) but get a nil object error message.. thanks.
thesaint4444: I am pretty new to rails and ruby so just learning...
darkblade747: hey guys, i've updated a table....
darkblade747: the new fields are showing up in my schema
darkblade747: i've restarted webrick....loaded my schema to the db...
darkblade747: migrated..everything
darkblade747: it's still not showing up for some reason, (2.0.2)
thuglife: Jellybob: i have no idea what can be wrong
[[thufir]]: how do calculate one datetime minus another?
thuglife: Jellybob: ahh
thuglife: the class column minght be problematic
thesaint4444: can anyone tell me how I get access to passed in form data for use in my controller methods?
Freedom_: thesaint4444: what kind of error do you get?
Freedom_: thesaint4444: which action are you refering to?
thesaint4444: Freedom: you have a nil object when you didnt expect it...
thesaint4444: Freedom: register
Jellybob: [[thufir]]: date1 - date2
solar_ant: is there any built in filter in action views that I can apply to a string which will precede everyline with a << ?
thuglife: Jellybob: yes. it was the class column. i renamed it and it works fine
thesaint4444: Freedom: when I try to use the kchash method...
Jellybob: thuglife: Ahhh - I didn't realise you had that one. ActiveRecord uses it internally
solar_ant: any help here please ?
thuglife: Jellybob: yup
thuglife: thanks tho
Jellybob: solar_ant: I'm not sure what you're asking for
[[thufir]]: Jellybob: can I put in my migration? in the model? or the view? controller? wherever I want? I put it in th emodel and got an error.
solar_ant: Jellybob: Jellybob Juhazi I have a varial @abc = "Hello \n how are you ?" . I want to know if there is any available method that will take @abc and convert it to "<<Hello \n <<How are you?"
solar_ant: oops
thesaint4444: Freedom: any idea? .. thanks.
solar_ant: or should I write a helper that will split the string by \n and for each line append "<<"
solar_ant: All i need is a link to some page containing action views text helpers :)
[[thufir]]: in my show.rhtml, how would I do "puts date_foo"?
solar_ant: got it . thanks
[[thufir]]: how do I put "hello world" into a show.rhtml? <% puts hello world %> or is it <%= ?
leethal: [[thufir]]: you know that, don't you?
leethal: if you know what <%= is, the answer should be obvious
[[thufir]]: leethal: I'm not sure how it works, I'm playing around with it.
leethal: did the playing produce any sensible results?
[[thufir]]: not yet, I can't get any output.
leethal: <%= "hello world" %> doesn't output anything?
[[thufir]]: hold on, afk . thanks, though.
[[thufir]]: leethal: thanks :)
noodl: hi guys. does anyone know how to get mongrel_cluster to set arbitrary environment variables (-e only sets RAILS_ENV) for each of the clustered mongrels?
thesaint4444: if I was to use - @customer = Customer.new(params[:customer]) in a controller would I be able to access the form params with say - ccode = @customer.ccode where ccode was a passed in form field?
Radar: thesaint4444, yes.
thesaint4444: Radar: ok thanks but when I then try to use ccode in a method like so - kchash = kcxor(kcode,ccode) I get a nil object error.... any ideas?
[[thufir]]: for this show.rhtml, http://goodfellow-tool.googlecode.com/svn/trunk/app/views/calls/show.rhtml , how can I format the date so that it's human readable? right now it's just a big number.
Robinayor_: is it possible to let form_remote_tag update a html-dom-element with the returned content from my update-action?
Jellybob: [[thufir]]: If it's really a date, date.to_s(:long)
leethal: [[thufir]]: http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model
Jellybob: leethal: Is that time of day again already?
leethal: [[thufir]]: don't do <%= @call.end - @call.start %>, abstract it to <%= @call.duration %>
pitchblack: thesaint4444, shouldn't it be @customer.cccode?
leethal: so, in a method in your model - (end - start).to_time
[[thufir]]: leethal: oooh, yeh. now, when I have call.duration, is that calculated on the fly, or should that be a field in the model? if it's a field in the model, where's calculation occur, in the model definition?
leethal: or something
leethal: [[thufir]]: there's no such thing as a field in the model, the fields are in the database
leethal: anyway, the method is just a instance method on the model class, so yes, it's calculated when you call it, not stored in the database
thesaint4444: pitchblack: why?
leethal: and what's the point with <%= "duration of the call:" %>?
leethal: why do you need that as a Ruby string?
[[thufir]]: leethal: I don't it could be html
thesaint4444: pitchblack: the variable is ccode not cccode....
[[thufir]]: leethal: aaargh, I gotta go, but, thank you, you gave me awesome food for thought :)
Jellybob: pitchblack: Surely that depends on what it is
leethal: hehe, np
brainopia: Is there something like rake db:migrate:all to migrate in all environments?
leethal: nope, you could make a task like that though
leethal: brainopia: however, I'd suggest not to =P
leethal: the task db shouldn't be migrated, it's just coping the structure from the dev. db
leethal: and the production db is holy, auto-migrating it sounds a bit dangerous
leethal: if you need to do production mode stuff in development, just use the dev db. in production mode
brainopia: leethel: at least for test and development envs =) i'm tired of doing rake db:migrate and then rake db:test:clone
leethal: the schema is cloned to the test db every time you run the tests
leethal: when you run it with the rake tasks, that is
leethal: rake test, rake test:functionals, rake test:units etc.
leethal: you could make a rake task that migrates, then clones the structure
leethal: so, rake db:migrate_and_clone, which runs db:migrate and then db:test:clone
pitchblack: thesaint4444, i misstyped it with extra 'c'
pitchblack: kchash = kcxor(kcode, @customer.ccode)
brainopia: leethal: do you know are 'rake spec' or 'autotest' cloning test db as well?
leethal: autotest isn't afaik
leethal: haven't used rspec a lot, so I'm not sure
leethal: I'd say it makes sense if it does, though
brainopia: leethal: anyway, thx for help =)
Jellybob: brainopia: autotest clones the db when it's first started, but not again until you restart it
brainopia: ok
thesaint4444: pitchblack: kchash = kcxor(@customer.kcode, @customer.ccode) doesn't work either... - is that the correct calling method?
pitchblack: thesaint4444, mind doing debugger just before that line? .)
leethal: what's kcxor? :O
pitchblack: i think it's custome made encryption method
leethal: encrypt() ftw =P
thesaint4444: lethal: it formats two 40 digit number and xor's the results...
J2RoR: what does the & do when you declear it inside a method definition ?
J2RoR: eg def method(&block)
leethal: that gives you a variable containing the block that's passed to the method
leethal: like, method { this_is_a_block }
thesaint4444: pitchblack: ok, thanks, how do you run the debugger? can you tell me or should I look it up?
pitchblack: ./script/server -u
pitchblack: and just type 'debugger' just before that line
thesaint4444: pitchblack: ok, thanks....
pitchblack: ohsix, you must gem install ruby-debug -y as well
pitchblack: damn,
J2RoR: is it the same asa Proc object and pass it to the method
pitchblack: i need a good tutorial on proc and blocks
pitchblack: with __practical examples__
J2RoR: leethal: is it called within the method ?
leethal: J2RoR: yes, you get a proc object
J2RoR: when is benefitial to use it within the definition of a method ?
leethal: J2RoR: http://pastie.org/148191
leethal: J2RoR: ah, fancy example coming up
noodl: hey. my app uses image_science and barfs if i run it with mongrel_cluster because HOME isn't set correctly (which causes RubyInline to try compilation in the wrong place). how can i have HOME set right?
pitchblack: ENV['HOME'] = '~'
thesaint4444: pitchblack: server hangs and stops at this line: kchash = kcxor(@customer.kcode,@customer.ccode)
pitchblack: i know
pitchblack: now type p @customer
pitchblack: and you should get @customer variable output
pitchblack: thesaint4444, more on using ruby-debug: http://railscasts.com/episodes/54
noodl: pitchblack: if i run mongrel_rails with HOME=/right/place on the command line it works. the trouble is that mongrel_cluster_ctl doesn't allow for arbitrary env vars to be set when it changes user and group
noodl: pitchblack: at least, i can't find a way to make it do so. any clues?
thesaint4444: pitchblack: thats pretty cool..... everything as it should be apart from kchash = nil
pitchblack: noodl, put that line in environment.rb
leethal: J2RoR: a crude, old and unflexible example, but oh well - http://pastie.caboo.se/pastes/108007
pitchblack: thesaint4444, then you should debug the method itself
noodl: pitchblack: ok i'll try. thanks
pitchblack: noodl, don't forget to restart the server!
leethal: J2RoR: instance_eval-ing a block causes the method in the block to be called, etc.
leethal: probably not a very good beginner sample
leethal: but doing stuff with &block is past the beginner stage anyway =P
noodl: pitchblack: awesome. it's a horrid hack, but it seems to work :)
pitchblack: n.p. .)
emilioeduardob: hi! anyone knows how can i create a record(say a Post) using XML from java
emilioeduardob: do i have to post to http://localhost:3000/Posts.xml? or /Posts?
pitchblack: o0
pitchblack: how do you post an xml data?
emilioeduardob: using httpconnection, and rails is supposed to add the record using REST
pitchblack: emilioeduardob, i presume you have restful design
emilioeduardob: yes
pitchblack: so you should post to /Posts
pitchblack: but isn't it possible to post just raw data?
emilioeduardob: how's that?
Jellybob: pitchblack: The REST stuff expects XML
pitchblack: Jellybob, then i'm too far away from it
thesaint4444: pitchblack: thanks, I will read debug stuff... very usefull :-)
Jellybob: You can create your own post as if it's from a form, but using XML is more reliable
pitchblack: thesaint4444, n.p. .)
pitchblack: ghm... i need to read again about that rest stuff
emilioeduardob: Jellybob in the comments of the generated controller it says POST /Posts.xml
emilioeduardob: but when i do that it creates an emtpy post
l1x: hay gais
l1x: how can i enforce the active record to start the id from 1
l1x: not just generate random number like 98989809327492
Jellybob: emilioeduardob: You need to pass it an XML document describing the post you want to create
Jellybob: There's a table of what does what about a quarter way down
leethal: l1x: that's just tests
emilioeduardob: Jellybob i'll give it a try
leethal: l1x: as in, test data inserted from test fixtures
leethal: so, in that case, AR sets the primary key
leethal: when you insert 'real data', AR doesn't set the primary key
leethal: which most likely causes the db engine to start from 1 =)
l1x: leethal ok
emilioeduardob: Jellybob dod you know how can i test if my XML data is getting to the rails server? it still creates an empty post =(
Jellybob: emilioeduardob: I'd check your log files first
emilioeduardob: on the development.log, in params it only shows 2 params, controller and action
emilioeduardob: if i try using the web form param shows all the fields with the data passed
Jellybob: emilioeduardob: Are you submitting the data in the request body?
blj: home8head
Jellybob: I'm afraid I don't know much Java, so I'm not sure how it's going to be working at that end
l1x: leethal thx!
l1x: leethal and how can i use fixtures for the prod environment?
Jellybob: You might want to try using ActiveResource to check the Rails end is working though
leethal: l1x: well, guess you could do rake db:fixtures:clone RAILS_ENV=production or something
leethal: however, bootstrap data should be kept separate imo
emilioeduardob: Jellybob i'll research about submitting data in the request body, it might be the problem
blj: l1x: i prefer doing the initialisation in db migration
Jellybob: blj: That's fine unless people do as they should be, and use db:schema:load - in which case your migrations aren't run
blj: Jellybob: people dont use migrations even today?
blj: Jellybob: anyway i said, "I prefer", which says, I dont care about others, but this is what I do.
Jellybob: blj: Load schema.rb - the top few lines are a comment explaining why migrations shouldn't be used to bring a production machine online
Robinayor_: are there already helper functions for the "Ajax.InPlaceEditor" from scriptaculous?
Jellybob: But if you're not bothered, fair enough
leethal: Robinayor_: think there's a (UGLY) plugin
leethal: it used to be in the rails core, but they extracted it to a plugin
leethal: perhaps there's other plugins around. if there is, you should probably use them
Robinayor_: leethal: thy did they?
Robinayor_: leethal: and why is the plugin so ugly?
leethal: not sure, but I guess it's because it's against the REST mantra of rails 2.0
Robinayor_: leethal: restfull ajaxß
leethal: huh?
Robinayor_: .oO(...)
JBob|Lunch: Robinayor_: It's a feature that most people doing Rails apps aren't going to need
|
|

