Ohm: how to drop a column/attribute? - ohm

There's an attribute that I no longer need, and I would like to drop it. I can't seem to simply remove the attribute from my model code, because there is an error when I load the instance. It complains that the myattrib= method does not exist. I guess it complains because Ohm sees the key in the database, but the attribute :myattrib does not exist in the model code.
How do I delete the column/attribute through Ohm, before I change my code and remove attribute :myattrib?

I tried this and it worked for me: Model.key[:myattrib].del
found it here: http://ohm.keyvalue.org/Ohm/Model.html#delete-instance_method

Related

Getting reference from model One2many relationship comodel inside an ir.actions.act_window

Would like to ask on how you can get the id of the comodel inside the ir.actions.act_window.
See my source code: https://gist.github.com/renesansz/2642b02875475383605e
Currently, I cannot get the sprint_id.project_id.current_sprint reference since it's giving me an error of Uncaught Error: NameError: name 'sprint_id' is not defined. So what I wanted to happen is that upon opening the project it should add a default filter for the current sprint of the project.
Do I have any alternative for this kind of approach?
Tried doing domain, but still no luck solving the issue.
Try this: make related field and then use this field in xml view.

How to modify {userinfoserial} via Pascal?

If I want to modify {userinfoserial} variable at the end of installation (user inputs only part of the serial during the installation process).
How can I modify {userinfoserial} through Pascal?
I do not want to create new variable, but modify existing.
I have tried several ways, but with no luck - unfortunately WizardUserInfoSerial is unknown identifier where WizardDirValue is OK what is strange to me...
If that is not possible, then I will create new variable.

Grails trouble saving object id

id is present in the params but does not save to the db. for example
[book.id:1, comments: good]
comments will save to db but book.id does not.
I need to figure out how to save params.book.id into the db column BOOK_ID that was created from the hasmany/belongsTo relationship.
By default value attribute of each element will be the result of a toString() call on each element. Setting it as optionKey allows the value to be a bean property of each element in the list.
Kindly change the select to
<g:form action="review">
<g:select name="book.id"
from="${item.Book.list()}"
value="${book?.id}"
/>
<g:textField name="bookreview" value="${params?.bookreview}" /><br>
kindly refer the below link
Grail example with optionkey
You have overwritten toString, therefore your books are always rendered by name and not id. If you remove your toString() method you will see the expected results.
If you want your select box work with the name, just add optionValue="name".
Well, it seems that I had misspelled a crucial parameter inside my domain. So the domain was expecting x and it was getting y. Thus the id was always null. It took me a while to spot it, and I was perplexed because I had previously successfully implemented ids in another project. Grails has some jira issues also that make one consider other possibilities, but this time it was my mistake.

Validate number of attributes with date_select

I'm doing something like the following: Validate number of nested attributes.
I'm checking for existence of at least one nested attribute.
This was working fine when I was using a text input for the date but I've changed it to use a date_select instead and now the same validation code shows an error saying that not enough have been chosen.
When it fails validation and reloads the form it also doesn't "build" an instance of the nested attribute either so it just shows my "[+]" link
Anybody got any ideas?
Failing everything I'll just have to put the text field back (probably using type=date).
Col
I decided to just put the text field back.

LINQPad 4 doesn't know about HttpUtililty - how to resolve?

I recently started using LINQPad to test bits and pieces and its a great time saver.
However, sometimes it gives me some errors with minor things.
when I want to test this:
HttpUtility.UrlPathEncode("Make sure");
I get this error: The name 'HttpUtility' does not exist in the current context.
Is there a way to get it to recognize basic stuff like HttpUtility?
I just tried writing:
System.Web.HttpUtility.UrlPathEncode("Make sure")
and I am shown this: The type or namespace name 'HttpUtility' does not exist in the namespace 'System.Web'
You need to a reference System.Web.dll. Press F4 (References) and add a reference to that DLL.
Or, if you have an autocompletion license, just type your original query:
HttpUtility.UrlPathEncode("Make sure");
and open the smart-tag that automatically appears. It will present a menu option to add the reference to System.Web.dll and import the System.Web namespace in a one-fell-click!